Skip to contents

plot_influence() plots measures from influence_diagnostics() against the linear predictor of a cox_ph() fit, one panel per measure. The highlight observations with the largest likelihood displacement are drawn in red and labelled with their row numbers.

Usage

plot_influence(
  fit,
  highlight = 3,
  panels = c("deviance", "leverage", "ld"),
  title = NULL
)

Arguments

fit

A cox_ph() fit.

highlight

The number of most influential observations to highlight.

panels

The measures to plot, any of "deviance", "leverage", "ld" (the likelihood displacement), and "martingale".

title

An optional plot title.

Value

A ggplot object.

Examples

fit <- cox_ph(Surv(time, status) ~ age + sex, data = lung)
plot_influence(fit)

plot_influence(fit, highlight = 5, panels = c("deviance", "leverage"))