Skip to contents

Artificial survival times of 37 patients classified by the levels of two two-level factors, A and B (Collett, 2023, Example 5.9).

Usage

numerical_illustration

Format

A data frame with 37 rows and 4 variables:

a

Level of factor A: 1 or 2.

b

Level of factor B: 1 or 2.

time

Survival time.

status

Event indicator: 1 = event, 0 = right-censored.

Source

Collett, D. (2023) Modelling Survival Data in Medical Research, 4th ed. Chapman & Hall/CRC, Example 5.9 (Table 5.1).

Details

The data are not real. They are constructed so that factor A has a proportional effect while the effect of factor B, and the interaction between A and B, are more complicated, and are used to compare Weibull proportional hazards and accelerated failure time models fitted to the same data (Example 5.9).

Aliases

The data set is available under the alias d5.9; 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 -----------------------------------
# Example 5.9: Weibull models for two two-level factors and their interaction
survival::survreg(
  survival::Surv(time, status) ~ factor(a) * factor(b),
  data = numerical_illustration, dist = "weibull"
)
#> Call:
#> survival::survreg(formula = survival::Surv(time, status) ~ factor(a) * 
#>     factor(b), data = numerical_illustration, dist = "weibull")
#> 
#> Coefficients:
#>           (Intercept)            factor(a)2            factor(b)2 
#>             3.7567255             0.7193676            -0.8379108 
#> factor(a)2:factor(b)2 
#>             1.7488892 
#> 
#> Scale= 0.5009488 
#> 
#> Loglik(model)= -163.2   Loglik(intercept only)= -185.6
#> 	Chisq= 44.83 on 3 degrees of freedom, p= 1e-09 
#> n= 37 

# The proportional hazards form of the same model
survival::coxph(
  survival::Surv(time, status) ~ factor(a) * factor(b),
  data = numerical_illustration
)
#> Call:
#> survival::coxph(formula = survival::Surv(time, status) ~ factor(a) * 
#>     factor(b), data = numerical_illustration)
#> 
#>                           coef exp(coef) se(coef)      z        p
#> factor(a)2            -1.17288   0.30948  0.52507 -2.234 0.025499
#> factor(b)2             1.55677   4.74347  0.57078  2.727 0.006382
#> factor(a)2:factor(b)2 -3.37987   0.03405  0.88920 -3.801 0.000144
#> 
#> Likelihood ratio test=37.24  on 3 df, p=4.086e-08
#> n= 37, number of events= 34 

# Modern tools --------------------------------------------------------
if (requireNamespace("flexsurv", quietly = TRUE)) {
  flexsurv::flexsurvreg(
    survival::Surv(time, status) ~ factor(a) * factor(b),
    data = numerical_illustration, dist = "weibull"
  )
}
#> Call:
#> flexsurv::flexsurvreg(formula = survival::Surv(time, status) ~ 
#>     factor(a) * factor(b), data = numerical_illustration, dist = "weibull")
#> 
#> Estimates: 
#>                        data mean  est     L95%    U95%    se      exp(est)
#> shape                      NA      1.996   1.536   2.595   0.267      NA  
#> scale                      NA     42.808  30.755  59.584   7.222      NA  
#> factor(a)2              0.568      0.719   0.268   1.171   0.230   2.053  
#> factor(b)2              0.459     -0.838  -1.333  -0.343   0.253   0.433  
#> factor(a)2:factor(b)2   0.270      1.749   1.069   2.429   0.347   5.748  
#>                        L95%    U95%  
#> shape                      NA      NA
#> scale                      NA      NA
#> factor(a)2              1.308   3.224
#> factor(b)2              0.264   0.710
#> factor(a)2:factor(b)2   2.911  11.351
#> 
#> N = 37,  Events: 34,  Censored: 3
#> Total time at risk: 2941
#> Log-likelihood = -163.1872, df = 5
#> AIC = 336.3744
#>