Sebastian.Wastl.Meyer at campus.lmu.de
2008-Sep-30 20:50 UTC
[Rd] anova.glm needs y = TRUE in glm() (PR#13098)
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