Skip to contents

influence_diagnostics() gathers the per-observation measures that flag influential rows of a cox_ph() fit into one table: the leverage, the martingale and deviance residuals, the approximate change in each coefficient when the row is left out (dfbeta, and dfbetas on the scale of the standard errors), and the likelihood displacement.

Usage

influence_diagnostics(fit)

Arguments

fit

A cox_ph() fit.

Value

A data frame with one row per observation used in the fit, and the columns leverage, martingale, deviance, dfbeta_<term> and dfbetas_<term> for each coefficient, and ld.

Details

The likelihood displacement of row \(i\) is \(\Delta\hat\beta_i^\top V^{-1} \Delta\hat\beta_i\), where \(\Delta\hat\beta_i\) is its dfbeta row and \(V\) is the model-based variance of the coefficients. A large value means that leaving the row out would move the coefficients a long way.

See also

residuals.cox_ph() for each measure on its own, and plot_influence() to plot them.

Examples

fit <- cox_ph(Surv(time, status) ~ age + sex, data = lung)
diagnostics <- influence_diagnostics(fit)
head(diagnostics[order(diagnostics$ld, decreasing = TRUE), ])
#>      leverage martingale  deviance    dfbeta_age  dfbeta_sex dfbetas_age
#> 6  0.22794948  -4.253709 -2.916748 -0.0039074212  0.03290293 -0.42364798
#> 85 0.16885747  -2.239470 -2.116351  0.0036173559  0.02412280  0.39219871
#> 38 0.07183483  -2.221561 -2.107871 -0.0007178925 -0.04360080 -0.07783489
#> 3  0.06946206  -3.129819 -2.501927  0.0019174721  0.02900413  0.20789497
#> 89 0.06103041  -1.234966 -1.571602  0.0019007326 -0.02087829  0.20608004
#> 68 0.05183713  -1.981377 -1.990667 -0.0003261349 -0.03793288 -0.03535999
#>    dfbetas_sex         ld
#> 6    0.1964847 0.22794948
#> 85   0.1440529 0.16885747
#> 38  -0.2603686 0.07183483
#> 3    0.1732025 0.06946206
#> 89  -0.1246778 0.06103041
#> 68  -0.2265218 0.05183713