[R] glm fitting routine and convergence

David Winsemius dwinsemius at comcast.net
Wed Nov 7 06:52:14 CET 2012


On Nov 6, 2012, at 1:44 PM, Christopher A. Simon wrote:

> What kind of special magic does glm have?
> 
> I'm working on a logistic regression solver (L-BFGS) in c and I've been
> using glm to check my results.  I came across a data set that has a very
> high condition number (the data matrix transpose the data matrix) that when
> running my solver does not converge, but the same data set with glm was
> converging ( I love R :) ).  I noticed that glm using IWLS to solve the MLE
> problem I also noticed that the results from glm suggest that glm checks
> for complete separation for variables. Besides this check for variable
> separation is glm doing anything else besides a straight implementation to
> IWLS that would allow it to converge for a near ill-posed data set?

I do not think that is a sufficiently precise description to support an up/down vote.

> Is it
> re-starting in some intelligent way?
> 
> My apologies if this is not the right place to post this message (wasn't
> sure if I should post here or in r-dev).

You should ask how you are handling your matrix operations. Look at the code, especially glm.fit. I think you will find that key function call is 

fit <- .Call(C_Cdqrls, x[good, , drop = FALSE] * 
                w, z * w, min(1e-07, control$epsilon/1000))

-- 

David Winsemius, MD
Alameda, CA, USA




More information about the R-help mailing list