dataLongTimeDep: Data Long Time Dependent Covariates

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/DiscSurvDataTransform.R

Description

Transforms short data format to long format for discrete survival modelling of single event analysis with right censoring. Covariates may vary over time.

Usage

1
dataLongTimeDep(dataSet, timeColumn, censColumn, idColumn, timeAsFactor=TRUE)

Arguments

dataSet

Original data in short format. Must be of class "data.frame".

timeColumn

Character giving the column name of the observed times. It is required that the observed times are discrete (integer).

censColumn

Character giving the column name of the event indicator. It is required that this is a binary variable with 1=="event" and 0=="censored".

idColumn

Name of column of identification number of persons as character.

timeAsFactor

Should the time intervals be coded as factor? Default is to use factor. If the argument is false, the column is coded as numeric.

Details

There may be some intervals, where no additional information on the covariates is observed (e. g. observed values in interval one and three but two is missing). In this case it is assumed, that the values from the last observation stay constant over time until a new measurement was done.

Value

Original data.frame with three additional columns:

Author(s)

Thomas Welchowski [email protected]

References

Ludwig Fahrmeir, (1997), Discrete failure time models, LMU Sonderforschungsbereich 386, Paper 91, http://epub.ub.uni-muenchen.de/

W. A. Thompson Jr., (1977), On the Treatment of Grouped Observations in Life Studies, Biometrics, Vol. 33, No. 3

See Also

contToDisc, dataLong, dataLongCompRisks

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Example Primary Biliary Cirrhosis data
library(survival)
dataSet1 <- pbcseq

# Only event death is of interest
dataSet1$status [dataSet1$status==1] <- 0
dataSet1$status [dataSet1$status==2] <- 1
table(dataSet1$status)

# Convert to months
dataSet1$day <- ceiling(dataSet1$day/30)+1
names(dataSet1) [7] <- "month"

# Convert to long format for time varying effects
pbcseqLong <- dataLongTimeDep (dataSet=dataSet1, timeColumn="month", 
censColumn="status", idColumn="id")
pbcseqLong [pbcseqLong$obj==1, ]

discSurv documentation built on May 29, 2017, 6:47 p.m.