Hi R helpers, I'm fitting large number of single factor logistic regression models as a way to immediatly discard factor which are insignificant. Everything works fine expect that for some factors I get error message "Singular information matrix in lrm.fit" which breaks whole execution loop... how to make LRM not to throw this error and simply skip factors with singularity problem... alternative solution also appreciated. Thanks
On Thu, 9 Oct 2008, useR wrote:> Hi R helpers, > > > > I'm fitting large number of single factor logistic regression models > as a way to immediatly discard factor which are insignificant. > Everything works fine expect that for some factors I get error message > "Singular information matrix in lrm.fit" which breaks whole execution > loop... how to make LRM not to throw this error and simply skip > factors with singularity problem...?try> > > alternative solution also appreciated.did you mean 'lrm' ? penalty = 0.0 is the default for lrm(). Use a small, positive value. Or use a score test, which for a single factor model could be obtained from lm(), IIRC. HTH, Chuck> > > Thanks > > ______________________________________________ > 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. >Charles C. Berry (858) 534-2098 Dept of Family/Preventive Medicine E mailto:cberry at tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
Hi,
I'm trying to do binary logistic regression on 10 covariables, comparing
glm to lrm from Harrell's Design package. They don't seem to agree on
whether the data is collinear:
> library(Design)
> load(url("http://www.csse.unimelb.edu.au/~gabraham/data.Rdata"))
> lrm(y ~ X1 + X2 + X3 + X4 + X5 + X6 + X7 + X8 + X9 + X10, data=x)
singular information matrix in lrm.fit (rank= 10 ). Offending variable(s):
X10
Error in j:(j + params[i] - 1) : NA/NaN argument
If I understand correctly, lrm is complaining about collinearity in the
data. However, the rank of the matrix is 10:
> qr(x)$rank
[1] 10
glm doesn't seem to care about the supposed collinearity, but does say
that the data are perfectly separable:
> glm(y ~ X1 + X2 + X3 + X4 + X5 + X6 + X7 + X8 + X9 + X10, data=x,
+ family=binomial(), control=glm.control(maxit=50))
Call: glm(formula = y ~ X1 + X2 + X3 + X4 + X5 + X6 + X7 + X8 + X9 +
X10, family = binomial(), data = x, control = glm.control(maxit = 50))
Coefficients:
(Intercept) X1 X2 X3 X4
X5
-6.921e+03 7.185e-02 4.344e-02 -3.980e-02 -5.362e-02
-6.387e-03
X6 X7 X8 X9 X10
2.455e-01 2.753e-02 -1.848e-01 1.903e-01 -3.187e-02
Degrees of Freedom: 27 Total (i.e. Null); 17 Residual
Null Deviance: 38.82
Residual Deviance: 4.266e-10 AIC: 22
Warning message:
In glm.fit(x = X, y = Y, weights = weights, start = start, etastart =
etastart, :
fitted probabilities numerically 0 or 1 occurred
What's the reason for this discrepancy?
Thanks,
Gad
--
Gad Abraham
Dept. CSSE and NICTA
The University of Melbourne
Parkville 3010, Victoria, Australia
email: gabraham at csse.unimelb.edu.au
web: http://www.csse.unimelb.edu.au/~gabraham