Skip to contents

Time from randomisation to linkage to primary care for 447 patients in a residential detoxification programme, in the HELP study (Collett, 2023, Example 16.7).

Usage

help

Format

A data frame with 447 rows and 7 variables:

subject

Patient identifier.

days

Time from randomisation to linkage to primary care, in days.

status

Event indicator: 1 = linked to primary care, 0 = censored.

age

Age of the patient in years.

gender

Gender: 0 = female, 1 = male.

housing

Housing status: 0 = homeless, 1 = housed.

linkage

Assistance from the HELP clinic in linking to primary care: 0 = no, 1 = yes.

Source

Collett, D. (2023) Modelling Survival Data in Medical Research, 4th ed. Chapman & Hall/CRC, Example 16.7 (Tables 16.1 and 16.2). Data from Samet et al. (2003); see also the mosaicData package.

Details

Patients undergoing detoxification for alcohol, heroin or cocaine who had no primary care physician were randomised to help from a HELP clinic or to no such help. The response is the number of days until linkage to primary care, and there are 167 events. The file is the complete-case version of the HELPmiss data set in the mosaicData package.

The example is the running illustration of Bayesian survival analysis: a Bayesian Weibull model and a piecewise exponential model (Example 16.7).

Aliases

The data set is available under the alias d16.7; 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 16.7: a Bayesian Weibull and piecewise exponential model
# Chapter 17 fits these with rstanarm::stan_surv(); the maximum likelihood
# counterparts below give the same point estimates of the hazard ratios.
survival::survreg(
  survival::Surv(days, status) ~ age + gender + housing + linkage,
  data = sta310r::help, dist = "weibull"
)
#> Call:
#> survival::survreg(formula = survival::Surv(days, status) ~ age + 
#>     gender + housing + linkage, data = sta310r::help, dist = "weibull")
#> 
#> Coefficients:
#> (Intercept)         age      gender     housing     linkage 
#> 10.52743496 -0.04022473 -0.56876407  0.25146226 -2.78118017 
#> 
#> Scale= 1.647617 
#> 
#> Loglik(model)= -1166.3   Loglik(intercept only)= -1217.5
#> 	Chisq= 102.32 on 4 degrees of freedom, p= <2e-16 
#> n= 447 

# Modern tools --------------------------------------------------------
if (requireNamespace("flexsurv", quietly = TRUE)) {
  flexsurv::flexsurvreg(
    survival::Surv(days, status) ~ age + gender + housing + linkage,
    data = sta310r::help, dist = "weibull"
  )
}
#> Call:
#> flexsurv::flexsurvreg(formula = survival::Surv(days, status) ~ 
#>     age + gender + housing + linkage, data = sta310r::help, dist = "weibull")
#> 
#> Estimates: 
#>          data mean  est        L95%       U95%       se         exp(est) 
#> shape           NA   6.07e-01   5.30e-01   6.95e-01   4.19e-02         NA
#> scale           NA   3.73e+04   7.57e+03   1.84e+05   3.04e+04         NA
#> age       3.59e+01  -4.02e-02  -7.30e-02  -7.41e-03   1.67e-02   9.61e-01
#> gender    7.67e-01  -5.69e-01  -1.22e+00   7.76e-02   3.30e-01   5.66e-01
#> housing   5.30e-01   2.51e-01  -2.58e-01   7.61e-01   2.60e-01   1.29e+00
#> linkage   5.19e-01  -2.78e+00  -3.47e+00  -2.09e+00   3.52e-01   6.20e-02
#>          L95%       U95%     
#> shape           NA         NA
#> scale           NA         NA
#> age       9.30e-01   9.93e-01
#> gender    2.97e-01   1.08e+00
#> housing   7.73e-01   2.14e+00
#> linkage   3.11e-02   1.24e-01
#> 
#> N = 447,  Events: 167,  Censored: 280
#> Total time at risk: 114996
#> Log-likelihood = -1166.334, df = 6
#> AIC = 2344.668
#>