| survdiffr | R Documentation |
Obtains bootstrap replicates of a quantile (e.g. the median) of the
survival time for each group of subjects. Confidence intervals of the
replicates can be computed with boot::boot.ci().
survdiffr(
formula,
data,
q,
B = 500,
boot.F = "WC",
boot.G = "none",
seed = NULL,
...
)
formula |
a formula object with a |
data |
a data frame in which to interpret the variables named in the formula. |
q |
quantile of the survival function whose time is bootstrapped. |
B |
number of bootstrap samples. |
boot.F |
a character string specifying the bootstrap procedure:
|
boot.G |
a character string specifying whether the censoring times
are also resampled from their empirical distribution: |
seed |
optional random seed for the bootstrap resampling (passed
to |
... |
additional arguments passed to the estimator used for the observed (non-bootstrap) quantile. |
Three resampling schemes are available through boot.F: nonparametric
resampling of gap times from the Peña-Strawderman-Hollander ("PSH")
or the Wang-Chang ("WC") estimates of the inter-occurrence time
distribution, and semiparametric resampling under the fitted gamma
frailty model ("semiparametric"). With boot.G = "empirical" the
per-subject censoring times are additionally resampled from their
empirical distribution.
All resampling uses R's random number generator, so results are
reproducible with set.seed() or the seed argument. The re-estimation
of the survival curve on each replicate can run in parallel, see
survrecThreads(). Some procedures (notably the semiparametric one,
which refits the frailty model on every replicate) can be slow.
An object of class boot (or a named list with one per group)
whose t0 is the observed quantile and t the bootstrap replicates.
A replicate is -1 when the survival estimate does not fall below
q, and NA when the resampled data had no events. For the
semiparametric procedure the component alpha contains the frailty
parameter estimated on each replicate.
González, J.R. and Peña, E.A. (2003). Bootstrapping median survival with recurrent event data. IX Conferencia Española de Biometría.
survfitr(), boot::boot.ci(), survrecThreads()
data(colon)
# compare the median survival time between the three Dukes stages
fit <- survdiffr(Survr(hc, time, event) ~ as.factor(dukes),
data = colon, q = 0.5, seed = 1
)
boot::boot.ci(fit$"1", type = c("norm", "basic", "perc"))
boot::boot.ci(fit$"2", type = c("norm", "basic", "perc"))
boot::boot.ci(fit$"3", type = c("norm", "basic", "perc"))
# 75th quantile with percentile confidence intervals
fit <- survdiffr(Survr(hc, time, event) ~ as.factor(dukes),
data = colon, q = 0.75, seed = 1
)
quantile(fit$"1"$t, c(0.025, 0.975))
# resampling from the PSH estimate instead
fit <- survdiffr(Survr(hc, time, event) ~ as.factor(dukes),
data = colon, q = 0.5, boot.F = "PSH", seed = 1
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.