Heymans, MW wrote:
Hi all,
Help is appreciated on this one.
I wrote some simple lines to apply the bootstrap and Cox regression
(used Canty's and Harrells functions).
bw.fun <- function(data, i){
d <- data[, i]
t <- d$dag2
e <- d$st2
dd <- datadist(d = d)
options(datadist = 'dd')
Srv <- Surv(t,e)
fit.bw <- cph(form.m, data = d, surv=TRUE, time.inc = 180, x = T, y = T)
fb <- fastbw(fit.bw)
list(coef(fb))
}
Martijn,
You are putting things inside the bootstrap loop that should be outside.
Also you are not taking advantage of the validate function in Design
that will do bootstrapping with bw=TRUE to use fastbw and will summarize
the volatility in selection of variables.
validate, calibrate, and bootcov in Design use lower-level functions for
fitting the resamples, which will also speed up the execution a good deal.
Frank
bw.boot <- boot(data = set, statistic = bw.fun, R = 5)
However, the regr. coeffiecients are not stored in bw.boot$t and I do
not know why? (it is the same with other fastbw values (like names.kept,
factors.kept). It is strange because If I do fastbw on the original
sample about 5 factors are kept in the model. Can somebody help me with
the solution?
Thank!
Martijn
PS. I also tried other selection levels for the variables, but no
difference (i.e. no selections).
--
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University
|