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.
|
weight_col
|
Name of the column containing IPW weights (e.g., as produced by compute_ipw_weights()). Set to NULL for unweighted estimation. Default: “wp99”.
|
covariate_cols
|
Character vector of column names to include as additional adjustment terms in the model. These covariates are used during g-computation standardization over baseline rows (month = 0), so they must be measured at or before baseline. Set to NULL for no additional adjustment. Default: NULL.
|
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).
|