dataprep_lt {intccr}R Documentation

Data preparation

Description

The function dataprep_lt reshapes data from a long format to a ready-to-use format to be used directly in the function ciregic_lt.

Usage

dataprep_lt(data, ID, W, time, event, Z)

Arguments

data

a data frame that includes the variables named in the ID, time, event, and z arguments

ID

a variable indicating individuals' ID

W

a vector of left-truncated time points

time

a variable indicating observed time points

event

a vector of event indicator. If an observation is righ-censored, event = 0; otherwise, event = 1 or event = 2, where 1 represents the first cause of failure, and 2 represents the second cause of failure. The current version of package only allows two causes of failure.

Z

a vector of variables indicating name of covariates

Details

The function dataprep_lt provides a ready-to-use data format that can be directly used in the function ciregic_lt. The returned data frame consists of id, v, u, c, and covariates as columns. The v and u indicate time window with the last observation time before the event and the first observation after the event. The c represents a type of event, for example, c = 1 for the first cause of failure, c = 2 for the second cause of failure, and c = 0 for the right-censored. For individuals having one time record with the event, the lower bound v will be replaced by zero, for example (0, v]. For individuals having one time record without the event, the upper bound u will be replaced by Inf, for example (v, Inf].

Value

a data frame

Author(s)

Jun Park, jun.park@alumni.iu.edu

Giorgos Bakoyannis, gbakogia@iu.edu


[Package intccr version 3.0.4 Index]