These functions override the crr function provided in cmprsk to produce more manageable competing risks model results (i.e. include model.frame and formula in output) so that results can leverage functions like broom::tidy the same way other regression function results do.

crr(formula, data, ...)

# S3 method for formula
crr(formula, data, ...)

# S3 method for default
crr(...)

## Arguments

formula formula object with response on the left of a ~ operator and terms on the right. Event variable can have multiple levels for use in competing risks. a data.frame in which to interpret the variables named in the formula Arguments passed on to cmprsk::crr ftimevector of failure/censoring times fstatusvector with a unique code for each failure type and a separate code for censored observations cov1matrix (nobs x ncovs) of fixed covariates (either cov1, cov2, or both are required) cov2matrix of covariates that will be multiplied by functions of time; if used, often these covariates would also appear in cov1 to give a prop hazards effect plus a time interaction tffunctions of time. A function that takes a vector of times as an argument and returns a matrix whose jth column is the value of the time function corresponding to the jth column of cov2 evaluated at the input time vector. At time tk, the model includes the term cov2[,j]*tf(tk)[,j] as a covariate. cengroupvector with different values for each group with a distinct censoring distribution (the censoring distribution is estimated separately within these groups). All data in one group, if missing. failcodecode of fstatus that denotes the failure type of interest cencodecode of fstatus that denotes censored observations subseta logical vector specifying a subset of cases to include in the analysis na.actiona function specifying the action to take for any cases missing any of ftime, fstatus, cov1, cov2, cengroup, or subset. gtoliteration stops when a function of the gradient is < gtol maxitermaximum number of iterations in Newton algorithm (0 computes scores and var at init, but performs no iterations) initinitial values of regression parameters (default=all 0) varianceIf FALSE, then suppresses computation of the variance estimate and residuals

## Examples


trial <- na.omit(trial)

#original crr
covars <- model.matrix(~ age + factor(trt) + factor(grade), trial)[,-1]
ftime1 <- trial$ttdeath fstatus1 <- trial$death_cr
mod_orig <- crr(ftime=ftime1,
fstatus = fstatus1,
cov1 = covars)

# using new wrapper function, accepts data and formula
mod_new <- crr(Surv(ttdeath, death_cr) ~ age + trt + grade, trial)