# NOT RUN {
library(survival)
set.seed(10)
d <- sampleData(40,outcome="survival")
nd <- sampleData(4,outcome="survival")
d$time <- round(d$time,1)
fit <- coxph(Surv(time,event)~X1 + strata(X2) + X6,
data=d, ties="breslow", x = TRUE, y = TRUE)
predictCoxPL(fit, newdata = d, times = 1:5)
fit <- coxph(Surv(time,event)~X1 + X2 + X6,
data=d, ties="breslow", x = TRUE, y = TRUE)
predictCoxPL(fit, newdata = d, times = 1:5)
#### Compare exp to product limit
set.seed(10)
A <- predictCoxPL(fit, newdata = d[1:5], times = 1:5, se = TRUE, band = TRUE, log.transform = FALSE)
set.seed(10)
B <- predictCox(fit, newdata = d[1:5], times = 1:5, se = TRUE, band = TRUE, log.transform = FALSE)
A$survival - B$survival
A$survival.lower - B$survival.lower
A$survival.upper - B$survival.upper
A$survival.lowerBand - B$survival.lowerBand
A$survival.upperBand - B$survival.upperBand
# }
Run the code above in your browser using DataLab