Predict Unadjusted Survival Curves

Description

Fits a pooled logistic regression with time modeled using restricted cubic splines and arm-by-time interaction terms, then uses g-computation to generate marginal survival curves for each trial arm.

Usage

predict_survival_unadjusted(
  long_data,
  outcome_col = "dead_t1",
  arm_col = "arm",
  month_col = "month2",
  id_col = "id",
  max_month = 95L,
  rcs_knots = c(6, 48, 72)
)

Arguments

long_data A data frame in long format (one row per participant-arm-month), as produced by expand_to_long(). Must contain columns specified by outcome_col, arm_col, and month_col. Both arms (“STOPBASE” and “CONTINUE”) must be present; a non-empty subset with only one arm will raise an error.
outcome_col Name of the binary outcome column (0/1, NA for censored). Default: “dead_t1”.
arm_col Name of the trial arm column (“STOPBASE” / “CONTINUE”). Default: “arm”.
month_col Name of the time variable column (0-indexed month relative to trial entry). Default: “month2”.
id_col Name of the participant identifier column, used to deduplicate baseline rows during standardization. Default: “id”.
max_month Maximum month for survival prediction. Rows with month beyond this value are excluded from both model fitting and prediction. Default: 95.
rcs_knots Numeric vector with at least 3 elements specifying the knots for the restricted cubic spline: the first element is the left boundary knot, the last element is the right boundary knot, and any middle elements are interior knots. Must have at least one interior knot. Default: c(6, 48, 72) (one interior knot at month 48).

Details

The model is:

P(event at t | survived to t) = logistic(
  beta_0 + beta_1*STOPBASE + beta_2*STOPBASE*t + beta_3*STOPBASE*t_rcs
  + beta_4*t + beta_5*t_rcs
)

where t_rcs is a restricted cubic spline basis with knots at positions specified by rcs_knots. Survival curves are obtained by the product-limit method applied to the predicted conditional hazard at each time point.

Value

A data frame with one row per month (0 through max_month), containing:

  • month: Month index (0-indexed from trial entry).

  • s_continue: Estimated survival probability in the CONTINUE arm.

  • s_stopbase: Estimated survival probability in the STOPBASE arm.

References

García-Albéniz X, Uno H, Bhatt DL, McArdle PH, Joffe MM, Hernán MA. Continuation of Annual Screening Mammography and Breast Cancer Mortality in Women Older Than 70 Years: A Prospective Observational Study. Ann Intern Med. 2020;172(6):381–389. doi:10.7326/M18-1199

See Also

predict_survival_baseline_adjusted(), predict_survival_ipw(), expand_to_long()

Examples

Code
library("ettbc")

cloned <- clone_censor(cohort, screening_mammograms, diagnostic_mammograms)
long_data <- expand_to_long(cloned)
surv <- predict_survival_unadjusted(long_data)
head(surv)
  month s_continue s_stopbase
1     0  0.9961485  0.9979071
2     1  0.9924180  0.9957995
3     2  0.9888043  0.9936770
4     3  0.9853035  0.9915398
5     4  0.9819117  0.9893876
6     5  0.9786251  0.9872205