Bugzilla – Bug 14960
Possible bug in anova.lmlist with test="Cp"
Last modified: 2012-06-26 16:10:30 UTC
while trying to define another anova method for a particular class, I noticed some problems with the method function for "lm" objects. When called on multiple models with test="Cp", R returns the error message:
Error in `[.data.frame`(table, , "Resid. Dev") :
undefined columns selected
y <- rnorm(20)
x <- rnorm(20)
f <- factor(rep(letters[1:2],each=10))
model1 <- lm(y~x)
model2 <- lm(y~x+f)
I believe there is an error in the anova.lmlist function.
At the fifth from the last line, I think:
n = length(objects[bigmodel$residuals])
should be replaced with:
n = length(objects[[bigmodel]]$residuals)
My apologies if this is not a bug.
With best wishes,