cfc.prepdata: Utility function for CFC data preparation

View source: R/cfc_survreg.R

cfc.prepdataR Documentation

Utility function for CFC data preparation

Description

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.

Usage

cfc.prepdata(formul, dat)

Arguments

formul

Original survival formula.

dat

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.

Details

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.

Value

A list with the following elements:

K

Number of causes.

dat

Expanded data frame.

formula.list

A list of K formulas, each corresponding to one of the cause-specific survival models to be estimated. See details.

formula.noresp

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.

tmax

Maximum time to event/censoring extracted from original data frame. This can be used, e.g., during competing-risk analysis.

Author(s)

Mansour T.A. Sharabiani, Alireza S. Mahani

References

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

Examples

data(bmt)
prep.out <- cfc.prepdata(Surv(time, cause) ~ platelet + age + tcell, bmt)

CFC documentation built on Jan. 9, 2023, 9:07 a.m.

Related to cfc.prepdata in CFC...