[R] Nomogram with multiple interactions (package rms)
marc.carpentier at ymail.com
Wed May 19 22:17:22 CEST 2010
I'm facing the following problem :
A cox model with my sex variable interacting with several continuous variables : cph(S~sex*(x1+x2+x3))
And I'd like to make a nomogram. I know it's a bit tricky and one mights argue that nomogram is not a good a choice...
I could use the parameter interact=list(sex=("male","female"),x1=c(a,b,c))... but with rcs or pol transformations of x1, x2 and x3, the choice of the categorization (a,b,c,...) is arbitrary and the nomogram not so useful...
Considering that sex is the problem, I thought I could draw two nomograms, one for each sex... based on one model. These would be great.
Do you think it's possible ?
Taking the exemple of the help of nomogram() (package "rms") :
f <- psm(Surv(d.time,death) ~ sex*age, dist=if(.R.)'lognormal' else 'gaussian')
Let's add the previously defined blood.pressure effect with an interaction with sex too (with cph) :
f2 <- cph(Surv(d.time,death) ~ sex*(age+blood.pressure))
I thought of the parameter adt.to :
plot(nomorgam(f2, adj.to=list(sex="male")) #and "female" for the other one
But nomogram() still wants me to define interact=list(...)
Thanks for any advice you might have (with adj.to or any alternative...)
More information about the R-help