15935
2014-08-15 11:22:11 +0000
drop1 gives error if no terms can be dropped
2014-08-15 11:58:38 +0000
1
1
1
Unclassified
R
Analyses
R 3.1.1
All
Linux
CLOSED
FIXED
P5
minor
---
1
Adrian.Baddeley
R-core
murdoch
oldest_to_newest
89300
0
Adrian.Baddeley
2014-08-15 11:22:11 +0000
drop1.lm, drop1.glm and drop1.default all give error messages if the fitted model has no terms that can be dropped. See examples below.
The bug is similar in each function:
ns <- length(scope)
.......
for(i in 1:ns) { ...... }
****
If there are no terms that can be dropped, then 'scope' = character(0), and 'ns' = 0, so a loop over 1:ns or seq(ns) is not correct.
Examples:
> y <- 1:3
> drop1(lm(y~1))
Error in data.frame(Df = dfs, `Sum of Sq` = c(NA, RSS[-1L] - RSS[1L]), :
'row.names' should specify one of the variables
> drop1(glm(y~1))
Error in data.frame(Df = dfs, Deviance = dev, AIC = aic, row.names = scope, :
'row.names' should specify one of the variables
> stats:::drop1.default(glm(y~1))
Error in terms.formula(tmp, simplify = TRUE) :
invalid model formula in ExtractVars
89301
1
murdoch
2014-08-15 11:58:38 +0000
I see this, and will fix it in R-devel and R-patched. Thanks!