Learn R Programming

PSsurvival (version 0.2.0)

var_surv_cox_bootstrap: Bootstrap Variance Estimation for Cox Survival Functions

Description

Estimates bootstrap variance for counterfactual survival functions from surv_cox(). Supports binary and multiple treatment groups.

Usage

var_surv_cox_bootstrap(
  data,
  surv_result,
  treatment_var,
  time_var,
  event_var,
  censoring_formula,
  censoring_control = list(),
  ties = "efron",
  B = 100,
  parallel = FALSE,
  mc.cores = 2,
  seed = NULL,
  boot_level = "full"
)

Value

List containing:

var_matrix

Matrix [time x group] of bootstrap variances.

se_matrix

Matrix [time x group] of bootstrap standard errors.

boot_samples

List of length B with survival matrices from each iteration.

boot_allocation

Matrix [B x group] of sample sizes for each group in each bootstrap iteration.

n_success_by_group

Matrix [time x group] of successful iterations.

n_failed_by_group

Matrix [time x group] of failed iterations.

B

Total bootstrap iterations.

Arguments

data

Data frame used in original surv_cox() call.

surv_result

Output from surv_cox().

treatment_var

Name of treatment variable.

time_var

Name of time variable.

event_var

Name of event indicator variable.

censoring_formula

Formula for censoring score model.

censoring_control

Control parameters for coxph(). Default list().

ties

Tie handling method for Cox model. Default "efron".

B

Number of bootstrap iterations. Default 100.

parallel

Logical. If TRUE, use parallel computation via mclapply. Default FALSE.

mc.cores

Number of cores for parallel computation. Default 2.

seed

Optional random seed for reproducibility. Ensures identical results across runs and between sequential and parallel execution. Default NULL.

boot_level

Bootstrap sampling level: "full" (default) samples from entire dataset, "strata" samples within each treatment group preserving group sizes.

Details

Each bootstrap iteration resamples observations with replacement and re-estimates propensity scores, weights, and survival functions using the same specifications as the original analysis. Treatment groups may fail independently if not sampled or if models fail to converge.