Skip to contents

glance() gives a summary of a fitted model as a data frame. For regression models it has one row, with the numbers of observations (n) and events (nevent) and model-level statistics such as the log-likelihood, AIC, and the likelihood ratio test. For curves, it has one row per curve, with strata and the grouping variables first, so the layout is the same for one curve or many.

Usage

# S3 method for class 'cox_ph'
glance(x, ...)

# S3 method for class 'kaplan_meier'
glance(x, ...)

# S3 method for class 'nelson_aalen'
glance(x, ...)

# S3 method for class 'turnbull'
glance(x, ...)

# S3 method for class 'aalen_johansen'
glance(x, ...)

# S3 method for class 'multi_state'
glance(x, ...)

# S3 method for class 'aft'
glance(x, ...)

# S3 method for class 'parametric'
glance(x, ...)

# S3 method for class 'piecewise_exponential'
glance(x, ...)

# S3 method for class 'royston_parmar'
glance(x, ...)

# S3 method for class 'aalen_additive'
glance(x, ...)

# S3 method for class 'buckley_james'
glance(x, ...)

# S3 method for class 'mixture_cure'
glance(x, ...)

# S3 method for class 'ipc_ridge'
glance(x, ...)

# S3 method for class 'cox_net'
glance(x, ...)

# S3 method for class 'fine_gray'
glance(x, ...)

# S3 method for class 'penalized_fine_gray'
glance(x, ...)

# S3 method for class 'survival_tree'
glance(x, ...)

# S3 method for class 'survival_forest'
glance(x, ...)

# S3 method for class 'gradient_boosting_survival_analysis'
glance(x, ...)

# S3 method for class 'survival_boost'
glance(x, ...)

# S3 method for class 'competing_risk_forest'
glance(x, ...)

Arguments

x

A fitted model.

...

Unused.

Value

A data frame.

Details

The columns for each model are:

The AIC is \(-2 \ell + 2k\) with \(k\) the number of estimated parameters, and the BIC replaces \(2\) with the log of the sample size (the number of events for the Cox and Royston-Parmar models).

See also

tidy() for one row per term, and augment() for one row per observation.

Examples

lung <- data.frame(
  time = c(306, 455, 1010, 210, 883, 1022, 310, 361, 218, 166, 170, 654, 728, 71, 567),
  status = c(2, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2),
  age = c(74, 68, 56, 57, 60, 74, 68, 71, 53, 61, 57, 68, 68, 60, 57),
  sex = c(1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 2, 2, 1, 1)
)
glance(cox_ph(Surv(time, status) ~ age + sex, data = lung))
#>    n nevent    loglik      aic lr_statistic df lr_p_value frailty_theta
#> 1 15     13 -26.90097 57.80194    0.6103106  2  0.7370089            NA
#>   frailty_lrt_statistic frailty_lrt_p_value
#> 1                    NA                  NA
glance(kaplan_meier(Surv(time, status) ~ sex, data = lung))
#>   strata sex n_start events median median_lower median_upper
#> 1  sex=1   1      11      9    306          210           NA
#> 2  sex=2   2       4      4    361          310           NA