Times from insertion of a catheter to its removal following infection, for 13 kidney patients (Collett, 2023, Example 4.1).
Format
A data frame with 13 rows and 5 variables:
- patient
Patient number (1-13).
- time
Time from insertion of the catheter to its removal, in days.
- status
Event indicator: 1 = catheter removed because of infection, 0 = removed for another reason.
- age
Age of the patient in years.
- sex
Sex: 1 = male, 2 = female.
Source
Collett, D. (2023) Modelling Survival Data in Medical Research, 4th ed. Chapman & Hall/CRC, Example 4.1 (Table 4.1). Data from McGilchrist and Aisbett (1991).
Details
The data relate to the 13 patients with kidney disease coded as type 3 by McGilchrist and Aisbett (1991). In the original study each patient could experience an infection of both the first and the second catheter, but only the time to removal of the first catheter is given here. There is a single censored observation (patient 6).
With 13 observations and 12 events the data set is used to demonstrate model-checking diagnostics for the Cox model: Cox-Snell, martingale and deviance residuals and influence (Examples 4.1-4.4), a non-linear effect of age and a time-dependent effect of sex (Examples 4.10-4.12).
Aliases
The data set is available under the aliases d4.1, d4.2, d4.3, d4.4,
d4.6, d4.7, d4.10, d4.11, d4.12; dX.Y is the alias for the data
set used in Example X.Y of Collett (2023). See dataset_by_exercise for
the complete index.
Examples
# Collett (2023), Chapter 17 style -----------------------------------
# Examples 4.1-4.4: Cox model and the model-checking residuals
fit_dialysis <- survival::coxph(
survival::Surv(time, status) ~ age + sex,
data = dialysis
)
summary(fit_dialysis)
#> Call:
#> survival::coxph(formula = survival::Surv(time, status) ~ age +
#> sex, data = dialysis)
#>
#> n= 13, number of events= 12
#>
#> coef exp(coef) se(coef) z Pr(>|z|)
#> age 0.03037 1.03084 0.02624 1.158 0.2470
#> sex -2.71076 0.06649 1.09590 -2.474 0.0134 *
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
#> exp(coef) exp(-coef) lower .95 upper .95
#> age 1.03084 0.9701 0.979168 1.0852
#> sex 0.06649 15.0407 0.007761 0.5696
#>
#> Concordance= 0.704 (se = 0.105 )
#> Likelihood ratio test= 6.48 on 2 df, p=0.04
#> Wald test = 6.13 on 2 df, p=0.05
#> Score (logrank) test = 8.56 on 2 df, p=0.01
#>
head(stats::residuals(fit_dialysis, type = "martingale"))
#> 1 2 3 4 5 6
#> 0.7199554 0.9276882 -0.2139338 0.9157260 -0.5060216 -0.2646313
head(stats::residuals(fit_dialysis, type = "dfbeta"))
#> [,1] [,2]
#> 1 0.0019689154 -0.19767070
#> 2 0.0004064069 0.54325979
#> 3 -0.0010557338 0.07414439
#> 4 -0.0118802079 0.59429830
#> 5 0.0049027405 0.01386377
#> 6 -0.0005416940 -0.11921930
# Examples 4.10 and 4.11: a non-linear effect of age
survival::coxph(
survival::Surv(time, status) ~ age + I(age^2) + sex,
data = dialysis
)
#> Call:
#> survival::coxph(formula = survival::Surv(time, status) ~ age +
#> I(age^2) + sex, data = dialysis)
#>
#> coef exp(coef) se(coef) z p
#> age 0.0881260 1.0921258 0.1021099 0.863 0.3881
#> I(age^2) -0.0008071 0.9991932 0.0013804 -0.585 0.5587
#> sex -2.8835708 0.0559347 1.1487372 -2.510 0.0121
#>
#> Likelihood ratio test=6.84 on 3 df, p=0.07731
#> n= 13, number of events= 12
# Example 4.12: a time-varying coefficient for sex
survival::coxph(
survival::Surv(time, status) ~ age + sex + tt(sex),
data = dialysis,
tt = function(x, t, ...) x * t
)
#> Call:
#> survival::coxph(formula = survival::Surv(time, status) ~ age +
#> sex + tt(sex), data = dialysis, tt = function(x, t, ...) x *
#> t)
#>
#> coef exp(coef) se(coef) z p
#> age 0.03318 1.03374 0.02686 1.235 0.217
#> sex -1.28076 0.27782 2.53323 -0.506 0.613
#> tt(sex) -0.07422 0.92847 0.12190 -0.609 0.543
#>
#> Likelihood ratio test=6.84 on 3 df, p=0.07712
#> n= 13, number of events= 12
# Modern tools --------------------------------------------------------
if (requireNamespace("rms", quietly = TRUE)) {
rms::cph(survival::Surv(time, status) ~ age + sex, data = dialysis, x = TRUE, y = TRUE)
}
#> Cox Proportional Hazards Model
#>
#> rms::cph(formula = survival::Surv(time, status) ~ age + sex,
#> data = dialysis, x = TRUE, y = TRUE)
#>
#> Model Tests Discrimination
#> Indexes
#> Obs 13 LR chi2 6.48 R2 0.410
#> Events 12 d.f. 2 R2(2,13) 0.291
#> Center -3.8404 P(> chi2) 0.0392 R2(2,12) 0.311
#> Score chi2 8.56 Dxy 0.408
#> P(> chi2) 0.0138
#>
#> Coef S.E. Wald Z P(>|Z|)
#> age 0.0304 0.0262 1.16 0.2470
#> sex -2.7108 1.0959 -2.47 0.0134
#>