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, ...)Details
The columns for each model are:
cox_ph()andcause_specific_cox():n,nevent,loglik,aic,lr_statistic,df,lr_p_value,frailty_theta,frailty_lrt_statistic, andfrailty_lrt_p_value(the frailty columns areNAwithout a frailty term).kaplan_meier():n_start,events,median,median_lower, andmedian_upper.nelson_aalen():n_start,events, andmax_cumhaz.turnbull():n,n_atoms,n_ambiguous(atoms that are intervals rather than points),n_iter, andconverged.aalen_johansen():n_causesandcauses.multi_state():n_states,states, andn_times.aft():dist,n,nevent,scale,Q(the generalized gamma's shape, missing for the other distributions),threshold,loglik, andaic.parametric():dist,n,nevent,loglik,aic, andbic.piecewise_exponential():n_intervals,n,nevent,loglik,aic,bic,df, andlr_statistic.royston_parmar():scale,n,nevent,loglik,aic,bic,df, andn_knots.aalen_additive():n,nevent,n_times, andtest.buckley_james():n,nevent,n_iter,converged, andn_boot.mixture_cure():n,nevent, andn_iter.ipc_ridge():n,nevent,alpha, andn_features.cox_net():n,nevent,loglik,aic,bic,effective_df,penalizer,l1_ratio, andn_nonzero.fine_gray():n,nevent, andloglik.penalized_fine_gray():n,nevent,penalizer,l1_ratio, andn_nonzero.survival_tree():n,nevent,n_nodes,n_leaves, andn_features.random_survival_forest()andextra_survival_trees():n,nevent,n_estimators,n_features, andoob_concordance.gradient_boosting_survival_analysis():n,nevent,n_estimators,learning_rate,max_depth, andn_features.survival_boost():n,nevent,n_causes,n_estimators,learning_rate,max_depth, andn_features.competing_risk_forest():n,nevent,n_estimators,n_features,n_causes,causes, andoob_concordance.
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).
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