[Rd] anova.glm needs y = TRUE in glm() (PR#13098)

From: <Sebastian.Wastl.Meyer_at_campus.lmu.de>
Date: Tue, 30 Sep 2008 22:50:12 +0200 (CEST)


Full_Name: Sebastian Meyer
Version: R version 2.7.2 (2008-08-25)
OS: x86_64-pc-linux-gnu
Submission from: (NULL) (138.246.7.137)

In contrast to anova.lm, which works without storing components 'model', 'x' and
'y' in the fitted lm-object, anova.glm throws an error if y = FALSE and if there
is more than one covariate in the corresponding glm() call:

Error in method(x = x[, varseq <= i, drop = FALSE], y = object$y, weights = object$prior.weights, :
  NAs in V(mu)

Reproduce this by e.g.:
fit <- glm(1:10 ~ I(1:10) + I((1:10)^2), y = FALSE) anova(fit)

This is not nice since it is not clear that the error inherits from the missing
'y' in the glm object. This dependence should be documented and a clear error
message should be thrown in this case.
Another (much better) idea is to eliminate this dependence in 'anova.glm'. This could be done by taking 'y' from e.g.

   model.response(model.frame(object))
instead of accessing 'object$y', which can be NULL.

Best regards,

    Sebastian Meyer



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed 01 Oct 2008 - 07:16:49 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 02 Oct 2008 - 03:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive