A generic nonparametric bootstrapping function for multi-state models.
Arguments
- theta
A function of
data
and perhaps other arguments, returning the value of the statistic to be bootstrapped; the output of theta should be a scalar or numeric vector- data
An object of class 'msdata', such as output from
msprep
- B
The number of bootstrap replications; the default is taken to be quite small (5) since bootstrapping can be time-consuming
- id
Character string indicating which column identifies the subjects to be resampled
- verbose
The level of output; default 0 = no output, 1 = print the replication
- ...
Any further arguments to the function
theta
Value
Matrix of dimension (length of output of theta) x B, with b'th column being the value of theta for the b'th bootstrap dataset
Details
The function msboot
samples randomly with replacement subjects from
the original dataset data
. The individuals are identified with
id
, and bootstrap datasets are produced by concatenating all selected
rows.
References
Fiocco M, Putter H, van Houwelingen HC (2008). Reduced-rank proportional hazards regression and simulation-based prediction for multi-state models. Statistics in Medicine 27, 4340–4358.
Examples
tmat <- trans.illdeath()
data(ebmt1)
covs <- c("score","yrel")
msebmt <- msprep(time=c(NA,"rel","srv"),status=c(NA,"relstat","srvstat"),
data=ebmt1,id="patid",keep=covs,trans=tmat)
# define a function (this one returns vector of regression coef's)
regcoefvec <- function(data) {
cx <- coxph(Surv(Tstart,Tstop,status)~score+strata(trans),
data=data,method="breslow")
return(coef(cx))
}
regcoefvec(msebmt)
#> scoreMedium risk scoreHigh risk
#> 0.545701 1.191317
set.seed(1234)
msboot(theta=regcoefvec,data=msebmt,id="patid")
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 0.4219375 0.539130 0.6494073 0.558677 0.3129345
#> [2,] 0.9633390 1.277396 1.2860004 1.340357 1.0736761