finegray2: 'finegray2'

finegray2R Documentation

finegray2

Description

Fit multiple finegray models.

Usage

finegray2(formula, data, cencode, ...)

Arguments

formula

a standard model formula, with survival on the left and covariates on the right

data

a data frame containing the variables in formula

cencode

optional censor code; if missing, the censor code will be guessed from the status variable

...

additional arguments passed to finegray or coxph

Examples

## example from survival::finegray
mg <- within(mgus2, {
  etime <- ifelse(pstat == 0, futime, ptime)
  event <- ifelse(pstat == 0, 2 * death, 1)
  event <- factor(event, 0:2, c('censor', 'pcm', 'death'))
})

pdata <- finegray(Surv(etime, event) ~ age + sex, data = mg)
coxph(Surv(fgstart, fgstop, fgstatus) ~ age + sex,
      weight = fgwt, data = pdata)

fg <- finegray2(Surv(etime, event) ~ age + sex, data = mg)
fg$pcm

## use the call and data to evaluate the equivalent coxph model
eval(fg$pcm$call, list(fgdata = fg$pcm$fgdata))


raredd/cmprsk2 documentation built on March 29, 2024, 5:34 a.m.