From Sebastian.Wastl.Meyer at campus.lmu.de  Tue Sep 30 22:50:12 2008
From: Sebastian.Wastl.Meyer at campus.lmu.de (Sebastian.Wastl.Meyer at campus.lmu.de)
Date: Tue, 30 Sep 2008 22:50:12 +0200 (CEST)
Subject: [Rd] anova.glm needs y = TRUE in glm() (PR#13098)
Message-ID: <20080930205012.314C0282EFC1@mail.pubhealth.ku.dk>

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



[Rd] anova.glm needs y = TRUE in glm() (PR#13098)
Sebastian.Wastl.Meyer at campus.lmu.de