Re: [R] Draw a nomogram after glm

From: Komine <momadou_at_yahoo.fr>
Date: Fri, 06 May 2011 11:21:51 -0700 (PDT)

Hi all R users,
Thanks Frank for your advices
In fact I posted all my script. In the R Help, the script for nomogram is long and I took only the part what I think interesting in my case. I use informations from( datadist {Design} and rms {rms}) in the help of R software to do my code.
I see that I progress with my nomogram. Because with the following code where I put my real variables names:

library(Design)
library(rms)
d <- datadist(Fire)
options(datadist='d')
f<-lrm(Ignition~FMC+Charge,data=Fire)
summary(f,FMC=c(0,506.40),Charge=c(45,646)) # min and max of FMC: 0 ,506.40 and the min and max of Charge: 45, 646
plot(Predict(f,FMC=0:506.40,Charge=646)) plot(nomogram(f, interact=list(Charge= c(.2,.7)))) # sorry, not understand vector c(.2,.7) from R help

As result, I have the figure 1 then figure 2 but there is a problem. Because the 3rd line of Figure 2 "Charge" must to go 0 until 650. Also the linear predictor must to go 0 until 1. http://r.789695.n4.nabble.com/file/n3503828/nomo.jpeg http://r.789695.n4.nabble.com/file/n3503828/nomogram.jpeg After, is it possible to draw my nomogram like the 3rd graph that I found in Internet, it is easier to understand.
http://r.789695.n4.nabble.com/file/n3503828/nogramme.bmp Nb: I Apologize for my bad english
Thanks for your help
Komine
PhD student
Dakar _Sénégal
West Africa

Komine wrote:
>
> Hi all R users
> I did a logistic regression with my binary variable Y (0/1) and 2
> explanatory variables.
> Now I try to draw my nomogram with predictive value. I visited the help of
> R but I have problem to understand well the example. When I use glm
> fonction, I have a problem, thus I use lrm. My code is:
> modele<-lrm(Y~L+P,data=donnee)
> fun<- function(x) plogis(x-modele$coef[1]+modele$coef[2])
> f <- Newlabels(modele,c(L="poids",P="taille"))
> nomogram(f, fun=list('Prob Y<=1'=plogis),
> fun.at=c(seq(0,1,by=.1),.95,.99),
> lmgp=.1, cex.axis=.6)
> fun.at=c(.01,.05,seq(.1,.9,by=.1),.95,.99),
> lmgp=.2, cex.axis=.6)
> options(Fire=NULL)
> Result is bad and I have this following error message:
> Erreur dans value.chk(at, i, NA, -nint, Limval, type.range = "full") :
> variable L does not have limits defined by datadist
>
> Could you help me on the code to draw nomogram.
> Nb: my English is low, I apologize.
> Thank for your help
> Komine
>

Komine wrote:
>
> Hi all R users
> I did a logistic regression with my binary variable Y (0/1) and 2
> explanatory variables.
> Now I try to draw my nomogram with predictive value. I visited the help of
> R but I have problem to understand well the example. When I use glm
> fonction, I have a problem, thus I use lrm. My code is:
> modele<-lrm(Y~L+P,data=donnee)
> fun<- function(x) plogis(x-modele$coef[1]+modele$coef[2])
> f <- Newlabels(modele,c(L="poids",P="taille"))
> nomogram(f, fun=list('Prob Y<=1'=plogis),
> fun.at=c(seq(0,1,by=.1),.95,.99),
> lmgp=.1, cex.axis=.6)
> fun.at=c(.01,.05,seq(.1,.9,by=.1),.95,.99),
> lmgp=.2, cex.axis=.6)
> options(Fire=NULL)
> Result is bad and I have this following error message:
> Erreur dans value.chk(at, i, NA, -nint, Limval, type.range = "full") :
> variable L does not have limits defined by datadist
>
> Could you help me on the code to draw nomogram.
> Nb: my English is low, I apologize.
> Thank for your help
> Komine
>

Komine wrote:
>
> Hi all R users
> I did a logistic regression with my binary variable Y (0/1) and 2
> explanatory variables.
> Now I try to draw my nomogram with predictive value. I visited the help of
> R but I have problem to understand well the example. When I use glm
> fonction, I have a problem, thus I use lrm. My code is:
> modele<-lrm(Y~L+P,data=donnee)
> fun<- function(x) plogis(x-modele$coef[1]+modele$coef[2])
> f <- Newlabels(modele,c(L="poids",P="taille"))
> nomogram(f, fun=list('Prob Y<=1'=plogis),
> fun.at=c(seq(0,1,by=.1),.95,.99),
> lmgp=.1, cex.axis=.6)
> fun.at=c(.01,.05,seq(.1,.9,by=.1),.95,.99),
> lmgp=.2, cex.axis=.6)
> options(Fire=NULL)
> Result is bad and I have this following error message:
> Erreur dans value.chk(at, i, NA, -nint, Limval, type.range = "full") :
> variable L does not have limits defined by datadist
>
> Could you help me on the code to draw nomogram.
> Nb: my English is low, I apologize.
> Thank for your help
> Komine
>

Hi all R users
I did a logistic regression with my binary variable Y (0/1) and 2 explanatory variables.
Now I try to draw my nomogram with predictive value. I visited the help of R but I have problem to understand well the example. When I use glm fonction, I have a problem, thus I use lrm. My code is: modele<-lrm(Y~L+P,data=donnee)
fun<- function(x) plogis(x-modele$coef[1]+modele$coef[2]) f <- Newlabels(modele,c(L="poids",P="taille")) nomogram(f, fun=list('Prob Y<=1'=plogis),  fun.at=c(seq(0,1,by=.1),.95,.99),

         lmgp=.1, cex.axis=.6)
         fun.at=c(.01,.05,seq(.1,.9,by=.1),.95,.99),
         lmgp=.2, cex.axis=.6)

options(Fire=NULL)
Result is bad and I have this following error message: Erreur dans value.chk(at, i, NA, -nint, Limval, type.range = "full") :   variable L does not have limits defined by datadist

Could you help me on the code to draw nomogram. Nb: my English is low, I apologize.
Thank for your help
Komine

--
View this message in context: http://r.789695.n4.nabble.com/Draw-a-nomogram-after-glm-tp3498144p3503828.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_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.
Received on Fri 06 May 2011 - 18:40:01 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 06 May 2011 - 18:40:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive