R-alpha: glm and substitute bugs

Jim Lindsey (jlindsey@luc.ac.be)
Mon, 13 Jan 1997 09:53:24 +0100 (MET)


From: Jim Lindsey <jlindsey@luc.ac.be>
Message-Id: <9701130853.AA01242@alpha.luc.ac.be>
Subject: R-alpha: glm and substitute bugs
To: r-testers@stat.math.ethz.ch (r-testers)
Date: Mon, 13 Jan 1997 09:53:24 +0100 (MET)

1. Kurt Hornik has asked me to look at a  data set where glm with
binomial gives all zero coefficients and S-Plus does not. It turns out
that R gives all zero coefficients (except the intercept) for all
binomial data sets! I have traced the problem to initialize in the
binomial family which is not properly evaluated. Consider the
following:
> substitute(y[1,2])
y[1,2] 
> substitute(y[,2])
y[2] 
I do not know how long this problem has existed because I have never
before used binomial, only Poisson. (GLIM4 is about 100 times faster,
and  even direct minimization with nlm is considerably faster than
glm.)
2. While tracing that problem down, I discovered that Ross's changes
to glm have introduced a new error. He has incorrectly changed the
initial values of eta so that IWLS no longer always converges (and
usually more slowly). Here is an example that does not converge with
the new initial estimates, giving completely wild values, but does
converge correctly with the old:

y <- c(3,5,4,3,11,20,31,40,43,48,48,50)
glm(y~1,family=poisson)

The initialization of eta in glm.fit should be put back the way it was
before:
start <- qr.coef(fit, w*z)