View source: R/pa_survival_eval_cr.R
| pa_summarize_cr | R Documentation |
Calls pa_survival_eval_cr() for each model in a named list and
returns a wide table where rows are metrics and columns are model names.
pa_summarize_cr(
models,
metrics = NULL,
t_star = NULL,
tau = NULL,
event_type = 1,
digits = 2,
censoring = c("cox", "km"),
censor_covariates = NULL,
calibration_args = list()
)
models |
A **named list**; each element is a list with components:
|
metrics |
Character vector of metrics to compute (passed through to
|
t_star |
(Optional) Evaluation time for Brier score, AUC, point R2, and calibration. Defaults to the median observed follow-up. |
tau |
(Optional) The maximum prediction time horizon for R2 and C index. Default is maximum of observation time. |
event_type |
Integer code for the cause of interest (passed through). |
digits |
Number of decimal places to round the metric values (default = 2). |
censoring |
Censoring estimator for generalized R-squared metrics, '"cox"' (default) or '"km"'; passed to [pa_survival_eval_cr()]. |
censor_covariates |
Optional numeric censoring-model covariates shared across models. Rows must match each model's subject order. Passed to [pa_survival_eval_cr()]; used only with 'censoring = "cox"'. |
calibration_args |
Optional named list passed to [pa_calibration_cr()]. |
See [pa_survival_eval_cr()] for the event-observation weighting rule, original-time support requirements and probability floor.
A data.frame with:
each row = metric
each column = model name
cell values = metric values
# Competing risks: cause 1 is the event of interest, cause 2 the competing
# risk. Both cause-specific hazards are modelled.
cr <- pa_simulate_fine_gray(n = 150, v = 2, beta1 = c(0.5, -0.5),
beta2 = c(-0.3, 0.3), censor = 0.3, seed = 2025)
cr$time <- cr$obs.times
cr$status <- cr$obs.event
m1 <- survival::coxph(survival::Surv(time, status == 1) ~ X1 + X2,
data = cr, x = TRUE, y = TRUE)
m2 <- survival::coxph(survival::Surv(time, status == 2) ~ X1 + X2,
data = cr, x = TRUE, y = TRUE)
p <- pa_predict_cif(model1 = m1, model2 = m2, newdata = cr,
covs = c("X1", "X2"), event.type = 1, tau = max(cr$time))
pa_summarize_cr(list(csh = p), event_type = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.