library(data.table)
set.seed(1)
dt.data <- simBuyseTest(1e2, n.strata = 2)
dt.data$time1 <- pmin(dt.data$eventtime, 1)
dt.data$status1 <- dt.data$status * (dt.data$eventtime<=1)
## KM
if(require(prodlim)){
e.KM <- prodlim(Hist(time1,status1)~1, data = dt.data)
plot(e.KM)
}
e.KM0 <- efronlim(Hist(time1,status1)~1, data = dt.data)
plot(e.KM0)
## stratfied KM
if(require(prodlim)){
e.KMS <- prodlim(Hist(time1,status1)~strata, data = dt.data)
plot(e.KMS)
}
e.KMS <- efronlim(Hist(time1,status1)~strata, data = dt.data)
plot(e.KMS)
Run the code above in your browser using DataLab