Adds bootstrap confidence intervals to a model fitted by coxphGPU() or
wceGPU(). The model is refitted on R resamples of the patients, in
batches on the GPU.
bootstrap(object, ...)
# S3 method for class 'coxphGPU'
bootstrap(
object,
R,
batchsize = 0,
init = TRUE,
control,
device = NULL,
double_precision = TRUE,
...
)
# S3 method for class 'wceGPU'
bootstrap(
object,
R,
batchsize = 0,
init = TRUE,
device = NULL,
double_precision = TRUE,
...
)A coxphGPU or wceGPU object.
Not used.
Number of bootstrap replicates.
Number of bootstrap replicates processed at a time. 0
(default): all of them at once. If you run out of memory, try 100, 10
or 1.
Starting coefficients of the refits. TRUE (default): the
coefficients of object. FALSE: zero. Or a numeric vector. For a
wceGPU model fitted with several nknots candidates, whose spline
coefficients have different lengths, TRUE starts from zero and a
numeric vector is not allowed.
(coxphGPU only) A survival::coxph.control() object.
Default: the one used to fit object.
Device on which the refits run ("cpu" or "cuda"). NULL
(default): the GPU if one is available.
Logical. TRUE (default) for 64-bit floats;
FALSE for 32-bit floats, faster on most GPUs.
A copy of object with its bootstrap components updated; the point
estimates (coefficients, variance, residuals, ...) are unchanged, so
summary(), plot() and HR() show the bootstrap confidence intervals.
For a coxphGPU model: coef_bootstrap (one row per replicate) and
nbootstraps.
For a wceGPU model: bootstrap_beta.hat.covariates,
WCEmat_bootstrap, WCEmat_CI, coef_CI, bootstrap.best.nknots,
nbootstraps, is_bootstraps, and bootstrap_est/est_CI for a
single nknots value.
For a coxphGPU model, object must have been fit with x = TRUE and
patient_id (coxphGPU(..., x = TRUE, patient_id = "id")). The bootstrap
resamples patients, not rows, so that all the rows of a patient (e.g. with
time-varying covariates) are kept together: patient_id tells which rows
belong to the same patient. The design matrix, the response and the
patient of each row are stored in the fit, so the bootstrap always uses
exactly the data the model was fitted on, including after subset = or
rows dropped for missing values.
For a wceGPU model, object must have been fit with x = TRUE
(wceGPU(..., x = TRUE)): the columns used by the model are stored in the
fit, and the bootstrap resamples them, so it always uses exactly the data
the model was fitted on. The spline-basis features are rebuilt from them
with the same knot configuration; the patient identifier is the id column
given at the fit.
If the model was fitted with several nknots candidates, the number of
knots is selected again in every bootstrap replicate (see
bootstrap.best.nknots), so that the confidence intervals account for the
uncertainty on that choice.
if (FALSE) { # \dontrun{
library(survival)
drugdata <- WCE::drugdata
fit <- coxphGPU(Surv(Start, Stop, Event) ~ sex + age,
data = drugdata, x = TRUE, patient_id = "Id")
fit_boot <- bootstrap(fit, R = 1000, batchsize = 200)
summary(fit_boot)
} # }
if (FALSE) { # \dontrun{
drugdata <- WCE::drugdata
fit <- wceGPU(data = drugdata, nknots = 1:3, cutoff = 90, id = "Id",
event = "Event", start = "Start", stop = "Stop",
expos = "dose", covariates = c("age", "sex"), x = TRUE)
fit_boot <- bootstrap(fit, R = 500, batchsize = 100)
summary(fit_boot)
table(fit_boot$bootstrap.best.nknots)
} # }