subdistn: Fine & Gray subdistribution model time to event times

Usage Arguments Author(s) References Examples

View source: R/splitFillCatFns.R

Usage

1
subdistn(survData)

Arguments

survData

Author(s)

N Green

References

A Proportional Hazards Model for the Subdistribution of a Competing Risk, Jason P. Fine and Robert J. Gray, Journal of the American Statistical Association, Vol. 94, No. 446 (Jun 1999), pp. 496-509.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (survData) 
{
    survData$time2disch <- survData$time2death <- survData$time
    mtime1 <- max(survData[survData$infstatus == 1, "time"], 
        na.rm = TRUE)
    survData$time2disch[survData$infstatus == 1 & survData$event & 
        survData$missingType] <- mtime1 + 1
    survData$time2death[survData$infstatus == 1 & !survData$event & 
        survData$missingType] <- mtime1 + 1
        
    mtime0 <- max(survData[survData$infstatus == 0, "time"], 
        na.rm = TRUE)
    survData$time2disch[survData$infstatus == 0 & survData$event & 
        survData$missingType] <- mtime0 + 1
    survData$time2death[survData$infstatus == 0 & !survData$event & 
        survData$missingType] <- mtime0 + 1
    survData
  }

n8thangreen/HESmanip documentation built on March 21, 2020, 12:20 a.m.