Preparing a data frame and formulas for cause-specific competing-risk survival analysis. It expands the multi-state status column into a series of binary columns by treating an event for a cause as censoring for all other causes.
cfc.prepdata(formul, dat)
A list with the following elements:
Number of causes.
Expanded data frame.
A list of K
formulas, each corresponding to one of the cause-specific survival models to be estimated. See details.
A formula with no left-hand side (time and status variables). This can be used for preparing the model matrix for prediction data sets, which can possibly have no response.
Maximum time to event/censoring extracted from original data frame. This can be used, e.g., during competing-risk analysis.
Original survival formula.
Original data frame, with status
column being an integer with values from 0
to K
. The value 0
represents right-censoring, while 1
to K
represent the K
mutually-exclusive events.
Mansour T.A. Sharabiani, Alireza S. Mahani
The output data frame will have K
new binary status columns. The K
new status columns will be named "status_1"
, "status_2"
through "status_<K>"
. Each of the output formulas in formula.list
field will have the corresponding status
. Column "status_1" will be 1
wherever status
equals 1
in original data frame, and 0
elsewhere, and similarly for the remaining K-1
newly-added status columns.
Mahani A.S. and Sharabiani M.T.A. (2019). Bayesian, and Non-Bayesian, Cause-Specific Competing-Risk Analysis for Parametric and Nonparametric Survival Functions: The R Package CFC. Journal of Statistical Software, 89(9), 1-29. doi:10.18637/jss.v089.i09
data(bmt)
prep.out <- cfc.prepdata(Surv(time, cause) ~ platelet + age + tcell, bmt)
Run the code above in your browser using DataLab