data(cancer,package="survival")
TR <- ovarian[1:16,]
TE <- ovarian[17:26,]
train.fit <- survival::coxph(survival::Surv(futime, fustat) ~ age, x=TRUE, y=TRUE,
method="breslow", data=TR)
lp <- predict(train.fit)
lpnew <- predict(train.fit, newdata=TE)
Surv.rsp <- survival::Surv(TR$futime, TR$fustat)
Surv.rsp.new <- survival::Surv(TE$futime, TE$fustat)
times <- 1:500
predErr(Surv.rsp, Surv.rsp.new, lp, lpnew, times,
type = "brier", int.type = "unweighted")
predErr(Surv.rsp, Surv.rsp.new, lp, lpnew, times,
type = "robust", int.type = "unweighted")
predErr(Surv.rsp, Surv.rsp.new, lp, lpnew, times,
type = "brier", int.type = "weighted")
Run the code above in your browser using DataLab