[Rd] model.frame error with formula=~1 and na.action=na.fail (PR#14066)

2009-11-16 Thread Sebastian . Wastl . Meyer
Full_Name: Sebastian Meyer
Version: 2.10.0
OS: x86_64-pc-linux-gnu
Submission from: (NULL) (77.135.124.96)


When using model.frame (model.frame.default) on an intercept-only model and with
na.action=na.fail SPECIFIED, i.e.

   data(iris)
   model.frame( ~ 1, data = iris, na.action = na.fail)

one gets the following error:

   Error in complete.cases(object) : negative length vectors are not allowed

There is no error if the na.action argument is left UNSPECIFIED (though the
default value also is na.fail!):

   model.frame( ~ 1, data = iris)

In either case, there should be no error. Specifing other na.action functions
(na.omit, na.pass, na.exclude) works.
If there is at least one (non-intercept) variable in the formula, e.g.

   model.frame( ~ 1 + Species, data = iris, na.action = na.fail)

there is obviously no issue. 

Best regards,
Sebastian Meyer

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


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

2008-10-01 Thread Sebastian . Wastl . Meyer
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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel