[R] using 'lrm' for logistic regression

Frank E Harrell Jr f.harrell at vanderbilt.edu
Mon Mar 3 14:39:22 CET 2008


Utkarsh Singhal wrote:
> Hi R,
> 
>  
> 
> I am getting this error while trying to use 'lrm' function with nine
> independent variables:
> 
>  
> 
>> res =
> lrm(y1994~WC08301+WC08376+WC08316+WC08311+WC01001+WC08221+WC08106+WC0810
> 1+WC08231,data=y)
> 
>  
> 
> singular information matrix in lrm.fit (rank= 8 ).  Offending
> variable(s):
> 
> WC08101 WC08221 
> 
> Error in j:(j + params[i] - 1) : NA/NaN argument
> 
>  
> 
> Now, if I take choose only four independent variables then there is no
> error.
> 
>  
> 
>> res = lrm(y1994~ WC08221+WC08106+WC08101+WC08231,data=y)
> 
>  
> 
>  
> 
> But strangely, if I use 'glm', with the family as binomial(logit) and
> with the same dataset, it is working perfectly fine.
> 
>  
> 
>> res =
> glm(y1994~WC08301+WC08376+WC08316+WC08311+WC01001+WC08221+WC08106+WC0810
> 1+WC08231,data=y,family=binomial(logit))
> 
>  
> 
> Any ideas..?
> 
>  
> 
> Regards
> 
> Utkarsh

Design's fitting functions are not kind about ignoring parameters 
associated with singular covariance matrices.  In glm you should see a 
zero for such coefficients.  In design you have to delete the singular 
variables manually.  Occasionally you have to tweak the tol argument to lrm.

A new function in Hmisc called redun will run a redundancy analysis to 
help understand the predictor collinearities.

Frank

> 
>  
> 
> This e-mail may contain confidential and/or privileged i...{{dropped:13}}
> 
> ______________________________________________
> 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