bug in glm (PR#397)
ripley@stats.ox.ac.uk
ripley@stats.ox.ac.uk
Mon, 10 Jan 2000 18:16:46 +0100 (MET)
On Mon, 10 Jan 2000, Peter Holzer wrote:
> Prof Brian Ripley writes:
> > > Date: Mon, 10 Jan 2000 11:53:50 +0100 (MET)
> > > From: holzer@stat.math.ethz.ch
> > >
> > > Dear R-team
> > >
> > > As I didn't get any answer to my bug-report last week I have taken the
> > > effort and extracted a minimal data set from my data (see below) where the
> > > following bug occurs:
> > >
> > > > glm(SKR.ein.aus ~ ., family = binomial, data = bugdata, na.action = na.omit)
> > > Error in names<-.default(*tmp*, value = ynames) : names attribute must be the
> > same length as the vector
> > Indeed, thank you (we needed an example). Alter
> >
> > names(w) <- ynames
> >
> > to
> > names(w) <- ynames[good]
> >
> > and
> >
> > names(fit$effects) <-
> > c(xxnames[seq(fit$rank)], rep("", nobs - fit$rank))
> >
> > to
> > names(fit$effects) <-
> > c(xxnames[seq(fit$rank)], rep("", sum(good) - fit$rank))
> >
> > as the vector w is dropping observations with fitted probs 0 or 1.
>
> This is actually a solution I thought of as well. However it has the
> disadvantage that plot (and other functions?) gets problems:
>
> > fit.tst <- glm(SKR.ein.aus ~ ., family = binomial, data = bugdata)
> Warning messages:
> 1: fitted probabilities of 0 or 1 occurred in: (if (is.empty.model(mt))
> glm.fit.null else glm.fit)(x = X, y = Y,
> .
> .
> .
> 7: Algorithm did not converge in: (if (is.empty.model(mt)) glm.fit.null else glm.fit)(x = X, y = Y,
> > plot(fit.tst)
We already know that plot.lm does not work correctly with glm objects with
zero weights. I am not at all sure it should be used for glm objects
(except Gaussian ones). However, I think you missed Martin M's point.
This behaviour indicates an inappropriate model, one with separation
of the groups, and all the linear approximations needed for a local lm
model are inappropriate.
We also know that the whole glm area needs a long hard look.
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._