[R] help with nomogram function

Frank E Harrell Jr feh3k at spamcop.net
Thu Nov 6 13:04:53 CET 2003


On Thu, 06 Nov 2003 17:41:45 +1000
Ross Darnell <r.darnell at uq.edu.au> wrote:

> 
> Frank Harrell wrote
>  
> > On Wed, 05 Nov 2003 09:22:34 +1000
> > Ross Darnell <r.darnell at uq.edu.au> wrote:
> > 
> > > I have fitted a logistic regression model
> > > 
> > > > failed.lr2$call
> > > lrm(formula = failed ~ Age + task2 + Age:task2, data = time.long, 
> > >     na.action = na.omit)
> > 
> > Use Age*task2 and omit na.action as na.omit is the default
> > 
> > > 
> > > using the Design package functions and would like to generate a
> > > nomogram from this model.
> > > 
> > > the datadist information is generated and stored in
> > > 
> > > > ddist
> > >                 time.long$Age time.long$task2
> > > Low:effect                 45            <NA>
> > > Adjust to                  56       both.foam
> > > High:effect                68            <NA>
> > > Low:prediction             21       both.foam
> > > High:prediction            80           right
> > > Low                        20       both.foam
> > > High                       80           right
> > 
> > This looks most strange.  You did not include the original code but I
> > suspect you had $ in a term.  $ should not appear in column headings
> > above.  Design wants you to use data= or attach, and avoid $ in terms.
> > 
> > 
> > > 
> > > Values:
> > > 
> > > time.long$task2 : both.foam left right 
> > > > 
> > > 
> > > The model fitted and then when I try the nomgram function
> > > 
> > > > nomogram(failed.lr2)
> > > Error in value.chk(at, i, NA, -nint, Limval, type.range = "full") : 
> > > 	variable Age does not have limits defined by datadist
> > > > 
> > > 
> > > I get an error. The NA values in ddist seem to be the problem but I
> > > don't understand the datadist information.
> > > 
> 
> I tried using the data argument in datadist
> 
> > names(my.data)
> [1] "subject" "Age"     "failed"  "task"   
> > ddist <- datadist(Age,task,data=my.data)
> Error in datadist(Age, task, data = my.data) : 
> 	Object "Age" not found
> 

Please read the documentation more carefully.  Either do ddist <-
datadist(my.data) (if the data frame contains the most up to date versions
of the variables) or attach(my.data);ddist <- datadist(Age, task).   -FH

> 
> Strange.
> 
> Thanks
> Ross Darnell
> 
> 
> --
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help


---
Frank E Harrell Jr    Professor and Chair            School of Medicine
                      Department of Biostatistics    Vanderbilt University




More information about the R-help mailing list