plot_coxSnell_residuals: Function to plot the Cox-Snell residuals of a fitted coxph...

Description Usage Arguments Value Examples

Description

This function assists the user in assessing model performance according to Cox-Snell residuals. The plot produced is designed to help the analyst understand how well the model fits. A well-fitting model will hug the diagonal.

Usage

1

Arguments

coxph_fit

The output from a fitted "coxph" call.

Value

A ggplot2 object presenting the Cox-Snell residuals for the model.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
library(survival)
data("heart")
# Coerce from factor
heart$transplant <- as.numeric(heart$transplant)
# Rescale age
heart$age <- heart$age+48
coxph_fit <- coxph(Surv(start, stop, event) ~
                    age + transplant +surgery,
                  data = heart,
                  x = TRUE)

plot_coxSnell_residuals(coxph_fit)


coxph_fit <- coxph(Surv(start, stop, event) ~
                     age + surgery + strata(transplant),
                  data = heart,
                  x = TRUE)

plot_coxSnell_residuals(coxph_fit)

benjamin-w-campbell/coxtools documentation built on May 31, 2019, 10:46 p.m.