min
2011-Nov-30 14:47 UTC
[R] Nomogram with stratified cph in rms package, how to get failure probability
Hello,
I am using Dr. Harrell's rms package to make a nomogram. I was able to make
a beautiful one. However, I want to change 5-year survival probability to
5-year failure probability.
I couldn?t get hazard rate from Hazard(f1) because I used cph for the model.
Here is my code:
library(rms)
f1 <- cph(Surv(retime,dfs) ~
age+her2+t_stage+n_stage+er+grade+cytcyt+Cyt_PCDK2 , data=data11,
surv=T, x=T, y=T, time.inc=5)
surv<- Survival(f1)
haz<- Hazard(f1)
Here is the Error in UseMethod("Hazard") :
no applicable method for 'Hazard' applied to an object of class
"c('cph',
'Design', 'coxph')"
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)
at.med1<-c(2,3,4, 5,6,7,8, 10,15,20,25, 30)
par(cex=0.8)
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),label.every=1, force.label=FALSE, cex.axis=0.8,
verbose=TRUE, cex.var=0.8)
How can I show failure probability instead of survival probability?
I would very much appreciate any assistance in this matter.
Thank you Very much.
--
View this message in context:
http://r.789695.n4.nabble.com/Nomogram-with-stratified-cph-in-rms-package-how-to-get-failure-probability-tp4123249p4123249.html
Sent from the R help mailing list archive at Nabble.com.
Frank Harrell
2011-Dec-01 16:14 UTC
[R] Nomogram with stratified cph in rms package, how to get failure probability
Hazard() is not implemented except for parametric survival models. You are not calling nomogram() correctly; in rms the plotting step is separated from the nomogram computations. To plot cumulative event rates do something like: mort10 <- function(lp) 1 - surv(10,lp) and tell nomogram about mort10 using fun=. Frank min wrote> > Hello, > > I am using Dr. Harrell's rms package to make a nomogram. I was able to > make a beautiful one. However, I want to change 5-year survival > probability to 5-year failure probability. > > I couldn?t get hazard rate from Hazard(f1) because I used cph for the > model. > > Here is my code: > > library(rms) > f1 <- cph(Surv(retime,dfs) ~ > age+her2+t_stage+n_stage+er+grade+cytcyt+Cyt_PCDK2 , data=data11, > surv=T, x=T, y=T, time.inc=5) > > surv<- Survival(f1) > haz<- Hazard(f1) > Here is the Error in UseMethod("Hazard") : > no applicable method for 'Hazard' applied to an object of class > "c('cph', 'Design', 'coxph')" > > > 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) > > at.med1<-c(2,3,4, 5,6,7,8, 10,15,20,25, 30) > > > par(cex=0.8) > 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),label.every=1, force.label=FALSE, cex.axis=0.8, > verbose=TRUE, cex.var=0.8) > > How can I show failure probability instead of survival probability? > > I would very much appreciate any assistance in this matter. > Thank you Very much. >----- Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in context: http://r.789695.n4.nabble.com/Nomogram-with-stratified-cph-in-rms-package-how-to-get-failure-probability-tp4123249p4129173.html Sent from the R help mailing list archive at Nabble.com.