bootstrap()
Bootstrap confidence interval for a Kaplan-Meier summary statistic.
Usage
bootstrap(
surv,
statistic,
*,
by=None,
weights=None,
n_boot=1000,
conf_level=0.95,
ci_type="percentile",
seed=None,
tau=None,
p=None,
times=None,
)Resamples subjects with replacement, fits a Kaplan-Meier estimator on each resample, and extracts the statistic of interest. The bootstrap distribution is then used to construct a confidence interval.
Parameters
surv: Surv-
A Surv response (right-censored or counting-process).
statistic: str | Callable[[KaplanMeier], float]-
The quantity to bootstrap. Pass a string for built-in statistics:
"median": median survival time."rmst": restricted mean survival time (requirestau=)."quantile": survival quantile (requiresp=)."survival": survival probability at a fixed time (requirestimes=)."median_diff": difference in median survival between two groups (requiresby=)."rmst_diff": difference in RMST between two groups (requiresby=andtau=)."survival_diff": difference in survival probability at a fixed time between two groups (requiresby=andtimes=).
Alternatively, pass a callable that takes a fitted KaplanMeier and returns a float.
by: Any = None-
Grouping variable for two-sample comparisons. Required for
"_diff"statistics. Must define exactly two groups. weights: Any = None-
Optional case weights passed through to each bootstrap KM fit.
n_boot: int = 1000-
Number of bootstrap replicates (default 1000).
conf_level: float = 0.95-
Confidence level (default 0.95).
ci_type: str = "percentile"-
Confidence interval type:
"percentile"(default),"normal", or"bca"(bias-corrected and accelerated). seed: int | None = None-
Random seed for reproducibility.
tau: float | None = None-
Upper time limit for RMST statistics.
p: float | None = None-
Quantile level for
"quantile"statistic. times: float | None = None-
Time point for
"survival"and"survival_diff"statistics.
Returns
BootstrapResult- Point estimate, standard error, confidence interval, and the full bootstrap distribution.