[R] Possible bug with lrm.fit in Design Library

Frank E Harrell Jr f.harrell at vanderbilt.edu
Fri Aug 21 14:59:04 CEST 2009


Noah to use predict, nomogram, summary, anova, etc. you need the fit 
object to be from the high level function (e.g., lrm).

Frank


Noah Silverman wrote:
> Hi,
> 
> I've come across a strange error when using the lrm.fit function and the 
> subsequent predict function.
> 
> The model is created very quickly and can be verified by printing it on 
> the console.  Everything looks good. (In fact, the performance measures 
> are rather nice.)
> 
> Then, I want to use the model to predict some values.  I get the 
> following error: "fit was not created by a Design library fitting function"
> 
> This is the exact same data and process I'm using with the lrm 
> function.  I thought I'd try lrm.fit to see if the results where better.
> 
> Since the model WAS created by a function of the Design library, I can't 
> see how it would then be rejected.
> 
> Below is the session transcript:
> 
> -------------------------------------------------------------------------------- 
> 
>  > fmodel <- lrm.fit(cbind(trainlogdata$v1, trainlogdata$v2), 
> trainlogdata$label)
>  > fmodel
> 
> Logistic Regression Model
> 
> lrm.fit(x = cbind(trainlogdata$v1, trainlogdata$v2), y = 
> trainlogdata$label)
> 
> 
> Frequencies of Responses
>     0     1
> 20988  6684
> 
>        Obs  Max Deriv Model L.R.       d.f.          P          C        
> Dxy
>      27672      8e-13    3876.12          2          0      0.744      
> 0.488
>      Gamma      Tau-a         R2      Brier
>       0.49      0.179      0.195      0.157
> 
>           Coef   S.E.    Wald Z P
> Intercept -2.890 0.04318 -66.92 0
> x[1]       5.864 0.23341  25.12 0
> x[2]       4.479 0.17256  25.95 0
> 
>  > predictions <- predict(fmodel, trainlogdata, type="fitted");
> Error in getOldDesign(fit) :
> 
> ______________________________________________
> 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.
> 


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




More information about the R-help mailing list