Skip to contents

cause_specific_cox() fits a Cox model to the hazard of one cause of a competing-risks response: among the subjects still free of any event, how the covariates change the rate of events of this cause. Subjects with an event of another cause leave the risk set at that time, as if censored, and the model is cox_ph() fit to the recoded response.

Usage

cause_specific_cox(formula, data, cause = 1, ...)

Arguments

formula

A formula with a competing-risks Surv() response on the left and the covariates on the right. The response is Surv(time, event) or Surv(start, stop, event) with event a factor whose first level means censored and each other level is a cause, as in Surv(time, factor(status, 0:2, c("censor", "pcm", "death"))) ~ age + sex. strata(), cluster(), and frailty() terms work as in cox_ph().

data

A data frame holding the variables in formula.

cause

The cause to model, a state name such as "pcm" or its number (1 for the first cause after censoring). The default is 1.

...

Further arguments for cox_ph(): weights, subset, na.action, ties, robust, cluster, frailty, frailty_cluster, conf_level, max_iter, and tol.

Value

A cause_specific_cox object, which is also a cox_ph object, so every cox_ph() method works on it: as.data.frame(), coef(), vcov(), predict() (survival curves predict being free of the cause, as if the other causes couldn't happen), residuals(), baseline_hazard(), and cox_zph(). It also holds cause (the state modeled) and states (all of the causes). n_event counts the events of the cause.

Details

The cause-specific hazard ratios describe the rate of the cause, not its cumulative incidence. A covariate that raises the hazard of a competing cause lowers the incidence of this one even when its cause-specific hazard ratio is 1. Use fine_gray() to model the cumulative incidence directly. Fitting one model per cause describes all of the hazards.

See also

fine_gray() for the subdistribution hazard, and aalen_johansen() for the cumulative incidence.

Examples

mgus <- data.frame(
  time = c(30, 45, 60, 72, 80, 95, 110, 120, 130, 150, 160, 180, 200, 210, 220, 240),
  status = c(1, 2, 0, 2, 1, 2, 0, 1, 2, 2, 0, 1, 1, 2, 0, 2),
  age = c(62, 75, 58, 80, 66, 71, 59, 64, 77, 82, 60, 68, 55, 79, 63, 74)
)
mgus$event <- factor(mgus$status, levels = 0:2, labels = c("censor", "pcm", "death"))

# The hazard of progression, with deaths taken as censoring
pcm <- cause_specific_cox(Surv(time, event) ~ age, data = mgus, cause = "pcm")
pcm
#> <cause_specific_cox> Surv(time, event) ~ age
#> Cause "pcm", with the other causes taken as censoring.
#> Efron ties. n = 16, events = 5
#> 
#>     estimate hazard_ratio std_error statistic p_value
#> age -0.07592       0.9269   0.05865    -1.295  0.1955
#> 
#> Likelihood ratio test: 1.9 on 1 df, p = 0.168
#> Wald test:             1.68 on 1 df, p = 0.195
#> Score test:            1.83 on 1 df, p = 0.176
#> Concordance: 0.659 (std. error 0.113)

# The hazard of death, as hazard ratios
death <- cause_specific_cox(Surv(time, event) ~ age, data = mgus, cause = "death")
as.data.frame(death, exponentiate = TRUE)
#>   term estimate  std_error statistic    p_value  conf_low conf_high
#> 1  age 1.163119 0.07730317  1.954706 0.05061776 0.9995936  1.353395