cfc.prepdata {CFC} | R 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 |

### 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 |

`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*version 1.2.0 Index]