riskset | R Documentation |
This function creates risk set at each unique failure time from a survival data set.
riskset(dat, entry=FALSE)
dat |
survival dataset with at least three variables: survival.times, survival.status and marker, in that order. The survival data set may have additional variables. In case of interval censored data, the first four columns are: entry time, exit time, status at exit and marker |
entry |
default is FALSE indicating right censored data. TRUE if left truncated data |
This function creates risk set at each unique failure time from a survival data set and is needed for llCoxReg(). The function can handle both right censored and interval censored data.
Returns a new data set with columns as follows: start, finish, newStatus and other variables from the original dataset except survival time and status. The first two columns correspond to the start and end of time intervals considered and the newStatus corresponds to the survival status of the patient corresponding to this interval, i.e. the status is 1 if the patient had event during this interval (start, finish] and 0 otherwise. Note that the survival time need to be in ascending order.
Patrick J. Heagerty
Heagerty, P.J., Zheng Y. (2005) Survival Model Predictive Accuracy and ROC curves Biometrics, 61, 92 – 105
library(MASS) data(VA) ## need to order the data in ascending order of survival time new.VA=VA[order(VA$stime),] risket.VA=riskset(new.VA)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.