get_schoenfeld {easysurv} | R Documentation |
Extract Schoenfeld Residuals
Description
This function extracts Schoenfeld residuals from a fitted cox.zph
object
and formats them into a tidy data frame.
Usage
get_schoenfeld(fit_zph)
Arguments
fit_zph |
An object of class |
Value
A tibble with the Schoenfeld residuals in long format, containing the columns:
time |
The time variable from the Cox model. |
transform |
The transformation applied to the time variable. |
variable |
The variable names from the Cox model for which residuals are calculated. |
residual |
The Schoenfeld residuals for each variable at each time point. |
Examples
library(survival)
test_fit <- survival::coxph(survival::Surv(time, status) ~ sex, data = lung)
test_fit_zph <- survival::cox.zph(test_fit)
get_schoenfeld(test_fit_zph)
[Package easysurv version 2.0.1 Index]