[R] lrm in Design package--missing value where TRUE/FALSE needed

Frank E Harrell Jr f.harrell at vanderbilt.edu
Sat Sep 5 04:47:57 CEST 2009


annie Zhang wrote:
> Hi, Frank,
>  
> I met the same problem. My data does not have NA, when I run
> fit <- lrm(Y_t~.,data=X)
> The error message is:
> singular information matrix in lrm.fit (rank= 35 ).  Offending variable(s):
> X35
>  Error in j:(j + params[i] - 1) : NA/NaN argument
> 
> How can I avoid this?
>  
> Thank you,
>  
> Annie

Please read earlier posts.  Avoid it by not having an overdescribed 
problem which will result in overfitting.

Frank

> On Fri, Sep 4, 2009 at 2:44 PM, Frank E Harrell Jr 
> <f.harrell at vanderbilt.edu <mailto:f.harrell at vanderbilt.edu>> wrote:
> 
>     Ping-Hsun Hsieh wrote:
> 
>         Hi,
> 
>         A error message arose while I was trying to fit a ordinal model
>         with lrm() I am using R 2.8 with Design package.
> 
>         Here is a small set of mydata:
>         RC      RS      Sex     CovA    CovB    CovC    CovD    CovE
>         2       1       0       1       1       0       -0.005575280    2
>         2       1       0       1       0       1       -0.001959580    2
>         3       0       0       0       1       0       -0.004725880    2
>         0       0       0       1       0       0       -0.005504850    2
>         2       1       1       0       0       0       -0.003880170    1
>         2       1       0       0       1       0       -0.006074230    2
>         2       1       0       0       1     1         -0.003963920    2
>         2       1       0       0       1       0        0.000658230    2
>         2       1       0       1       0       1       -0.002033610    2
>         0       0       0       0       0       1       -0.007761770    2
>         0       0       0       0       1       1       -0.000951784    2
> 
>         Note: In the complete data, there are NAs. But the error
>         messages showed in both the complete and above sets.
> 
>             attach(mydata)
>             lrm(RC~RS+Sex+CovA+CovB+CovC+CovD+CovE,data=mydata,na.action=na.pass)
> 
>         singular information matrix in lrm.fit (rank= 8 ).  Offending
>         variable(s):
>         CovE Error in j:(j + params[i] - 1) : NA/NaN argument
> 
>             detach(mydata)
>             lrm(mydata$RC~ mydata$RS+ mydata$Sex+ mydata$CovA+
>             mydata$CovB+ mydata$CovC+ mydata$CovD+
>             mydata$CovE,data=mydata,na.action=na.pass)
> 
> 
>     Please read the documentation.  Use data=.  Don't use $ in variables
>     in the model.  I don't know what na.pass is.  lrm does not allow NAs
>     to be used in the attempted model fit.
> 
>     Frank
> 
> 
>         Error in if (!length(fname) || !any(fname == zname)) { :
>          missing value where TRUE/FALSE needed
> 
> 
>         I have debugged for a while, but no success. Does anyone know
>         what happens?
> 
>         Thanks,
>         Mike
>         ______________________________________________
>         R-help at r-project.org <mailto: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
>         <http://www.r-project.org/posting-guide.html>
>         and provide commented, minimal, self-contained, reproducible code.
> 
>




More information about the R-help mailing list