I have 4 intervals of interest:
Right now I'm subsetting my dataset like this:
# Set time period
time_period.first <- 30/365.25
time_period.intermediate <- .5
....
# TREOP = Time in years
data.first = all_data
# Remove already censored data
data.intermediate = subset(data.first, data.first$TREOP > time_period.first)
# Set all outside as censored
data.first$RREOP[data.first$TREOP > time_period.first] = 0
data.first$TREOP[data.first$TREOP > time_period.first] = time_period.first
data.intermediate$RREOP[data.intermediate$TREOP > time_period.second] = 0
data.intermediate$TREOP[data.intermediate$TREOP > time_period.second] = time_period.second
....
I'm doing cox regression with the 'survival' package (I also use the cph in the 'Design' package for C-statistic calculations).
Is there a better way of performing this left-truncation & right-censoring?
Ideal would be:
# TREOP - time in years
# RREOP - event
surv <- Surv(TREOP, RREOP, start=30/365.25, stop=.5)
I've looked at the help and the time, time2 & type seem to do handle truncation but I think that it's for a more complex setting where subjects enter the study after 22 days and not for splitting data into intervals.
I've found the survSplit() function in the survival package but although it by description seems right I'm not sure how to tame it - the example doesn't really help me out. Anyone have any experience with it?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.