# NOT RUN {
#### Survival model ####
data(breastCancer)
class(breastCancer$gradd1) <- "character"
class(breastCancer$gradd2) <- "character"
traindata <- breastCancer[sample(nrow(breastCancer), nrow(breastCancer)*2/3),]
newdata <- breastCancer[-sample(nrow(breastCancer), nrow(breastCancer)*2/3),]
model <- rms::cph(survival::Surv(rectime, censrec) ~ rms::rcs(age,6) +
rms::rcs(nodes,3) + rms::rcs(pgr,3) + gradd1 + gradd2 +
hormon, data = traindata)
lp <- predict(model, newdata = newdata)
#### R2sh example ####
R2sh(newdata$rectime, newdata$censrec, lp, data = newdata, R = 50)
#### R2pm example ####
R2pm(lp, R = 50)
#### cal.slope example ####
cal.Slope(newdata$rectime, newdata$censrec, lp, R = 50)
# }
Run the code above in your browser using DataLab