crisk_setup {JMbayes2}R Documentation

Transform Competing Risks Data in Long Format

Description

In a competing risks setting this function expands the data frame with a single row per subject to a data frame in the long format in which each subject has as many rows as the number of competing events.

Usage

crisk_setup(data, statusVar, censLevel,
    nameStrata = "strata", nameStatus = "status2")

Arguments

data

the data frame containing the competing risk data with a single row per subject.

statusVar

a character string denoting the name of the variable in data that identifies the status variable which equals 1 if the subject had any of the competing events and 0 otherwise.

censLevel

a character string or a scalar denoting the censoring level in the statusVar variable of data.

nameStrata

a character string denoting the variable that will be added in the long version of data denoting the various causes of event.

nameStatus

a character string denoting the variable that will be added in the long version of data denoting if the subject experience any of the competing events.

Value

A data frame in the long format with multiple rows per subject.

Author(s)

Dimitris Rizopoulos d.rizopoulos@erasmusmc.nl

References

Rizopoulos, D. (2012) Joint Models for Longitudinal and Time-to-Event Data: with Applications in R. Boca Raton: Chapman and Hall/CRC.

Putter, H., Fiocco, M., and Geskus, R. (2007). Tutorial in biostatistics: Competing risks and multi-state models. Statistics in Medicine 26, 2389–2430.

Examples

head(crisk_setup(pbc2.id, "status", "alive"))

[Package JMbayes2 version 0.5-0 Index]