Thanks for the answer. Unfortunately, I'm not yet skilled enough to do such a thing. I had a look on the code and I'll try to understand it, as a good exercise. I thought about sending fake fit objects to nomogram() derived from the original one : - orignal : f2<- cph(Surv(d.time,death) ~ sex*(rcs(cholesterol,4)+blood.pressure) - manually derived : * fMale : with coef rcs(cholesterol,4) and blood.pressure form f2, no sex effect * fFemale : with "agregated" coef sex:rcs(cholesterol,4) for cholesterol and sex:blood.pressure for BP and an obligatory sex effect. But I failed to fool your function. Had to try though...
Marc ----- Message d'origine ---- De : Frank E Harrell Jr <f.harr...@vanderbilt.edu> À : Marc Carpentier <marc.carpent...@ymail.com> Cc : r-help-request Mailing List <r-help@r-project.org> Envoyé le : Jeu 20 mai 2010, 15h 30min 27s Objet : Re: Re : Re : [R] Nomogram with multiple interactions (package rms) On 05/20/2010 01:42 AM, Marc Carpentier wrote: > Thank you for your responses, but I don't think you're right about the doc... > I carefully looked at it before posting and ran the examples, looked in > Vanderbilt Biostat doc, and just looked again example(nomogram) : > 1st example : categorical*continous : two axes for each sex > f<- lrm(y ~ lsp(age,50)+sex*rcs(cholesterol,4)+blood.pressure) Hi Marc, My apologies; I misread my own example. This will take some digging into the code. If you have time to do this before I do, code change suggestions welcomed. Frank > > > 2nd : continous*continous : one "age" axe for each specified value of > cholesterol > g<- lrm(y ~ sex + rcs(age,3)*rcs(cholesterol,3)) > > 3rd and 4th : categorical*continous : two axes for each sex (4th with fun) > f<- psm(Surv(d.time,death) ~ sex*age, dist='lognormal') > > 5th : categorical*continous : two axes for each sex (with fun) > g<- lrm(Y ~ age+rcs(cholesterol,4)*sex) > > I'm desperately trying to represent a case of > categorical*(continous+continous) : > f2<- cph(Surv(d.time,death) ~ sex*(rcs(cholesterol,4)+blood.pressure) > The best solution I can think of is to draw one nomogram for each sex : > Assuming 'male' is the ref level of sex : > 1st nomogram : one axe for rcs(cholesterol,4), one axe for blood.pressure > 2nd nomogram : one axe for sex:rcs(cholesterol,4), one axe for > sex:blood.pressure, both shifted because of the sex own effect. > (I badly draw it in my previous mail) > I didn't see any example of this "adjustement" of nomogram to 'male' or > 'female'... > > I hope I gave a clearer explanation and I'm not wrong about this unmentioned > case. > > Marc > > > > > ----- Message d'origine ---- > De : Frank E Harrell Jr<f.harr...@vanderbilt.edu> > À : Marc Carpentier<marc.carpent...@ymail.com> > Cc : r-help-request Mailing List<r-help@r-project.org> > Envoyé le : Jeu 20 mai 2010, 0h 55min 32s > Objet : Re: Re : [R] Nomogram with multiple interactions (package rms) > > On 05/19/2010 04:36 PM, Marc Carpentier wrote: >> I'm sorry. I don't understand the "omit" solution, and maybe I mislead you >> with my explanation. >> >> With the data from the "f" exemple of nomogram() : >> Let's declare : >> f2<- cph(Surv(d.time,death) ~ sex*(age+blood.pressure)) >> I guess the best (and maybe the only) way to represent it with a nomogram is >> to plot two nomograms (I couldn't find better). >> Is there a way to have : >> >> Nomogram1 : "male" : >> - points 1-100 --------------- >> - age ("men") --------------- >> - blood.pressure ("men") --------------- >> - linear predictor --------------- >> >> And nomogram2 : "female" : >> - points 1-100 --------------- >> - age ("female") --------------- >> - blood.pressure ("female") --------------- >> - linear predictor --------------- >> >> As I said I tried and failed (nomogram() still wants me to define >> interact=list(...)) with : >> plot(nomorgam(f2, adj.to=list(sex="male")) #and "female" for the other one >> >> Marc > > I think the documentation tells you how to do this. But you failed to > look at the output from example(nomogram). In one of the examples two > continuous predictors have two axes each, with male and female in close > proximity. Or maybe I'm just missing your point. > > Frank > >> >> >> >> ----- Message d'origine ---- >> De : Frank E Harrell Jr<f.harr...@vanderbilt.edu> >> À : Marc Carpentier<marc.carpent...@ymail.com>; r-help-request Mailing >> List<r-help@r-project.org> >> Envoyé le : Mer 19 mai 2010, 22h 28min 51s >> Objet : Re: [R] Nomogram with multiple interactions (package rms) >> >> On 05/19/2010 03:17 PM, Marc Carpentier wrote: >>> Dear list, 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 ? >> >> Yes, you can specify constant predictors not to draw with the omit= >> argument. But try first to draw everything. Shouldn't you just get 2 >> axes each for x1 x2 x3? >> >>> >>> Taking the exemple of the help of nomogram() (package "rms") : f<- >>> psm(Surv(d.time,death) ~ sex*age, dist=if(.R.)'lognormal' else >>> 'gaussian') >> >> Drop the if(.R.) which was just corrected in the documentation. Use >> dist='lognormal' >> >> Frank >> >>> >>> 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...) >>> >>> Marc Carpentier >>> >> >> > > -- Frank E Harrell Jr Professor and Chairman School of Medicine Department of Biostatistics Vanderbilt University ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.