Skip to content
Prev 59792 / 398502 Next

Error in anova(): objects must inherit from classes

The lme method for anova() checks the inheritance of the object when a
single object is supplied, which is why there is no error when you use one
object at a time.  When two objects are supplied, the method uses the class
of the object by invoking the data.class function (which does not list
glmmPQL class).  If you replace the check of the class with a check of
inheritance it should work.

Following is a check from the example listed in MASS (Venables and Ripley)
+                  family = binomial, data = bacteria)
iteration 1 
iteration 2 
iteration 3 
iteration 4 
iteration 5 
iteration 6
+                  family = binomial, data = bacteria)
iteration 1 
iteration 2 
iteration 3 
iteration 4 
iteration 5 
iteration 6
numDF denDF F-value p-value
(Intercept)     1   169      35  <.0001
I(week > 2)     1   169      21  <.0001
numDF denDF F-value p-value
(Intercept)     1   169      35  <.0001
trt             2    47       2    0.22
I(week > 2)     1   169      20  <.0001
Error in anova.lme(x1, x2) : Objects must inherit from classes "gls", "gnls"
"lm","lmList", "lme","nlme","nlsList", or "nls"

After replacement:
Model df  AIC  BIC logLik   Test L.Ratio p-value
x1     1  4 1107 1121   -550                       
x2     2  6 1114 1134   -551 1 vs 2     2.6    0.28


Matt Austin
Statistician

Amgen 
One Amgen Center Drive
M/S 24-2-C
Thousand Oaks CA 93021
(805) 447 - 7431
well.com>

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html