cfc.prepdata: Utility function for CFC data preparation

Description Usage Arguments Details Value Author(s) Examples

View source: R/cfc_survreg.R

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

1
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

Examples

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

CFC documentation built on June 21, 2017, 5:03 p.m.