R/bootstrap_survival.R
bootstrap_survival.RdPerform Per-Feature Survival Modeling on Bootstrap Resamples
bootstrap_survival(x, meta.info, formula.str, competing_risks)A list of data matrices (bootstrap resample), where each element corresponds to a resampled group. Rows represent features (e.g., proteins, metabolites) and columns represent samples.
A data frame containing the metadata for the samples,
including time, event, and any additional covariates used
in formula.str.
A string specifying the formula to be used in model
fitting. Must include a Surv(time, event) term. The per-feature
coefficient term (y) is prepended automatically.
Logical. If FALSE (default), a Cox
proportional hazards model is fitted per feature using coxph.
If TRUE, a competing risks model is fitted per
feature using crr from the cmprsk package.
A list containing the following elements:
A numeric vector of absolute coefficients (\(|\beta|\)) for each feature.
A numeric vector of standard errors of the coefficients for each feature.
For each feature (row), the function constructs a temporary data frame
combining the bootstrap-resampled expression values (y) with the
sample metadata. It then fits either a Cox proportional hazards model
(competing_risks = FALSE) or a Fine subdistribution
hazard model (competing_risks = TRUE) per feature, extracting
the coefficient and its standard error for the feature term y.