pa_summarize: Summarize multiple survival models into a wide comparison...

View source: R/pa_survival_eval.R

pa_summarizeR Documentation

Summarize multiple survival models into a wide comparison table

Description

Calls pa_survival_eval() for each model in a named list and outputs a wide table: each row corresponds to one metric and each column corresponds to a model.

Usage

pa_summarize(
  models,
  metrics = NULL,
  t_star = NULL,
  tau = 1e+11,
  digits = 2,
  calibration_args = list()
)

Arguments

models

A **named list** in which each element corresponds to a fitted model. Each model entry must itself be a list containing:

  • times – numeric vector of observed follow-up times.

  • surv_prob – an n \times K matrix (or data frame) of subject-specific predicted survival probabilities on a common time grid.

  • status – event indicator (1 = event, 0 = censored).

  • pred – (optional) predicted mean survival time (restricted or unrestricted).

  • new_data – (optional) dataset used for prediction.

  • covs – character vector of covariate names used for prediction.

  • model – (optional) the underlying fitted survival model object.

Note: If pred is provided, it will be used to calculate R2 and concordance measure.

metrics

Optional character vector of metrics to compute (passed through).

t_star

Optional evaluation time for point metrics and calibration. Defaults to the median observed follow-up.

tau

Optional numeric scalar, specify the max time horizon for R2 measure and concordance measure (default = 10e10).

digits

Number of decimal places to round the metric values (default = 2).

calibration_args

Optional named list passed to [pa_calibration()].

Value

A data frame with:

  • Each row = metric

  • Each column = model name

  • Cell values = corresponding rounded metric values

Examples

d <- pa_sim_cox_weibull(n = 150, pi_c = 0.3, v = 2,
                        beta = c(0.5, -0.5), seed = 2025)
d <- d[, c("time", "status", "x1", "x2")]
fit <- survival::coxph(survival::Surv(time, status) ~ x1 + x2,
                       data = d, x = TRUE, y = TRUE)
pred <- pa_predict_coxph(model = fit, covs = c("x1", "x2"), new_data = d)

# one column per model, metrics down the rows
pa_summarize(list(cox = pred))

PAmeasures documentation built on Oct. 29, 2026, 1:08 a.m.