[R] formula for calculating the survival probability for nomogram
min
myi at mdanderson.org
Wed Nov 30 20:21:11 CET 2011
Hi, I used Dr. Harrell's rms package to make a nomogram.
Below is my code for nomogram and calculate total points and probability *in
original data set* used for building the nomogram. *My question is how I get
the formula for calculating the survival probability for this nomogram. Then
I can use this formula to do validation by using other data set. *
f1 <- cph(Surv(retime,dfs) ~ age+her2+t_stage+n_stage+er+cytcyt+Cyt_PCDK2 ,
data=data11,
surv=T, x=T, y=T, time.inc=5)
surv<- Survival(f1)
surv10 <- function(lp) surv(10,lp)
surv5 <- function(lp) surv(5,lp)
quant <- Quantile(f1)
at.surv <- c(0.1, 0.3, 0.5, 0.7, 0.9)
nom<- nomogram(f1, conf.int=F,
fun=list(surv5, surv10), funlabel=c('5-Year Survival Probability', '10-Year
Survival Probability' ), lp=F,
fun.at=c(at.surv, at.surv))
################# total points ##########################
age.p <- lm(nom[[1]]$points ~ nom[[1]]$age)
tot.points <- (age*age.p$coef[2]+age.p$coef[1])+
(her2=='Positive')*nom[[2]]$points[2] +
(t_stage=='T2/T3')*nom[[3]]$points[1]+(n_stage=='N1/N2')*nom[[4]]$points[2]+(er=='Negative')*nom[[5]]$points[1]
+
(cytcyt=='Positive')*nom[[6]]$points[2]+(Cyt_PCDK2=='Positive')*nom[[7]]$points[2]
summary(tot.points)
data22 <- data.frame(retime=retime, dfs=dfs, tot.points=tot.points)
fit <- cph(Surv(retime, dfs) ~ tot.points,data=data22 ,surv=T, x=T, y=T,
time.inc=5)
survff <- survfit.cph(fit, newdata=data22)
times <-survff$time
probb <- survff$surv
############# 5 year ##################
indd <- times==times[times<=5][length(times[times<=5])]
probb2 <- probb[indd,] ## 5-year surv prob for each patient
I would very much appreciate any assistance in this matter.
Thank you Very much.
Min
--
View this message in context: http://r.789695.n4.nabble.com/formula-for-calculating-the-survival-probability-for-nomogram-tp4124387p4124387.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list