Using finalfit conventions, produces multivariable Competing Risks Regression models for a set of explanatory variables.

crrmulti(.data, dependent, explanatory, ...)

Arguments

.data

Data frame or tibble.

dependent

Character vector of length 1: name of survival object in form Surv(time, status). Status default values should be 0 censored (e.g. alive), 1 event of interest (e.g. died of disease of interest), 2 competing event (e.g. died of other cause).

explanatory

Character vector of any length: name(s) of explanatory variables.

...

Other arguments to crr

Value

A multivariable crr fitted model class crr.

Details

Uses crr with finalfit modelling conventions. Output can be passed to fit2df.

See also

fit2df, finalfit_merge

Other finalfit model wrappers: coxphmulti(), coxphuni(), crruni(), glmmixed(), glmmulti_boot(), glmmulti(), glmuni(), lmmixed(), lmmulti(), lmuni(), svyglmmulti(), svyglmuni()

Examples

library(dplyr)
melanoma = boot::melanoma
melanoma = melanoma %>%
  mutate(
    # Cox PH to determine cause-specific hazards
    status_coxph = ifelse(status == 2, 0, # "still alive"
      ifelse(status == 1, 1, # "died of melanoma"
        0)), # "died of other causes is censored"
        
    # Fine and Gray to determine subdistribution hazards
    status_crr = ifelse(status == 2, 0, # "still alive"
      ifelse(status == 1, 1, # "died of melanoma"
        2)), # "died of other causes"
    sex = factor(sex),
    ulcer = factor(ulcer)
  )

dependent_coxph = c("Surv(time, status_coxph)")
dependent_crr = c("Surv(time, status_crr)")
explanatory = c("sex", "age", "ulcer")

# Create single well-formatted table
melanoma %>%
  summary_factorlist(dependent_crr, explanatory, column = TRUE, fit_id = TRUE) %>%
  ff_merge(
    melanoma %>%
      coxphmulti(dependent_coxph, explanatory) %>%
      fit2df(estimate_suffix = " (Cox PH multivariable)")
    ) %>%
  ff_merge(
    melanoma %>%
      crrmulti(dependent_crr, explanatory) %>%
      fit2df(estimate_suffix = " (competing risks multivariable)")
    ) %>%
  select(-fit_id, -index) %>%
  dependent_label(melanoma, dependent_crr)
#> Dependent variable is a survival object
#>   Dependent: Surv(time, status_crr)                   all
#> 2                               sex         0  126 (61.5)
#> 3                                           1   79 (38.5)
#> 1                               age Mean (SD) 52.5 (16.7)
#> 4                             ulcer         0  115 (56.1)
#> 5                                           1   90 (43.9)
#>   HR (Cox PH multivariable) HR (competing risks multivariable)
#> 2                         -                                  -
#> 3 1.60 (0.95-2.71, p=0.080)          1.61 (0.94-2.75, p=0.084)
#> 1 1.01 (1.00-1.03, p=0.107)          1.01 (0.99-1.03, p=0.370)
#> 4                         -                                  -
#> 5 4.02 (2.25-7.21, p<0.001)          3.81 (2.16-6.72, p<0.001)