Resamples subjects from the original subject-level data and repeats the complete analysis in every bootstrap replicate: cloning, strategy-specific artificial censoring, person-time expansion, censoring-model estimation, weighting, and outcome-model estimation.

emul_estimate_bootstrap(
  data,
  arms,
  id,
  treatment,
  time_to_treatment,
  grace_period,
  outcome,
  followup,
  censoring_predictors = NULL,
  censoring_method = c("pooled_logit", "stabilized_logit", "Cox"),
  numerator_predictors = NULL,
  censoring_time_spline_df = NULL,
  method = c("Cox", "logistic"),
  predictors = NULL,
  n_bootstrap = 200,
  conf_level = 0.95,
  eps = 1e-06,
  seed = NULL
)

Arguments

data

A data frame with one row per subject.

arms

A character vector of length two. The first element names the strategy of not receiving treatment during the grace period; the second names the strategy of receiving treatment during the grace period.

id

Name of the column that uniquely identifies subjects.

treatment

Name of the binary treatment column.

time_to_treatment

Name of the numeric time-to-treatment column.

grace_period

Positive numeric length of the treatment grace period.

outcome

Name of the binary outcome column.

followup

Name of the numeric follow-up-time column.

censoring_predictors

Optional character vector of predictors for the denominator censoring model.

censoring_method

Censoring model passed to estimate_censoring(): "pooled_logit", "stabilized_logit", or "Cox".

numerator_predictors

Optional character vector of predictors for the numerator model when censoring_method = "stabilized_logit".

censoring_time_spline_df

Degrees of freedom for the natural cubic spline of interval start time in pooled-logistic censoring models. Set to an integer of at least 2 to use a spline. The default NULL uses a linear time term. Ignored when censoring_method = "Cox".

method

Outcome analysis method: "Cox" or "logistic".

predictors

Optional adjustment predictors for the outcome model.

n_bootstrap

Number of bootstrap resamples.

conf_level

Confidence level for the percentile interval.

eps

Probability floor passed to estimate_censoring() and weight_cases().

seed

Optional random seed.

Value

A list containing the full-sample effect estimate, percentile confidence limits, bootstrap estimates, and analysis settings. Effects are returned on the exponentiated coefficient scale: a hazard ratio for Cox models and an odds ratio for logistic models.

Examples

data(lungcancer)
boot <- emul_estimate_bootstrap(
  lungcancer,
  arms = c("Control", "Surgery"),
  id = "id",
  treatment = "surgery",
  time_to_treatment = "timetosurgery",
  grace_period = 182.62,
  outcome = "death",
  followup = "fup_obs",
  censoring_predictors = c("age", "sex"),
  predictors = c("age", "sex"),
  n_bootstrap = 3,
  seed = 1
)