-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Douglas Bates
Sent: Friday, November 26, 2004 3:13 PM
To: Spencer Graves
Cc: R-help; bates at cs.wisc.edu; Jose.Pinheiro at pharma.novartis.com
Subject: Re: [R] help with glmmPQL
Spencer Graves wrote:
HI, DOUG & JOSE:
Is there some reason that "anova.lme" should NOT
of class "glmmPQL" in the example below? If you don't see
then I suggest you consider modifying the code as described below.
I don't think that would be appropriate. AFAIK the logLik
generic applied to a glmmPQL object does not return the
likelihood of the fitted model or an approximation to that likelihood.
That's why there is a difference between the values of the
likelihood for the same model fit by glmmPQL and fit using
the PQL method in GLMM from the lme4 package.
I will add anova methods for GLMM objects whenever I manage
to dig myself out of the current rewrite of the
representation of linear mixed-effects models.
HI, ANDREW:
I couldn't find your data "learning" in my Windows
of R 2.0.0pat, which meant that I had to take the time to
example before I could get the error message you described.
from modifying the example in the documentation for
fit1 <- glmmPQL(y ~ trt, random = ~ 1 | ID,
family = binomial, data = bacteria)
fit2 <- glmmPQL(y ~ trt + I(week > 2), random = ~ 1 | ID,
family = binomial, data = bacteria) anova(fit1,
fit2)
Error in anova.lme(fit1, fit2) : Objects must inherit
"gls", "gnls" "lm","lmList", "lme","nlme","nlsList", or "nls"
I then checked the class of fit1 and fit2: > class(fit1)
[1] "glmmPQL" "lme" > class(fit2)
[1] "glmmPQL" "lme"
As an experiment, I changed the class of fit1 and fit2: >
class(fit1) <- "lme"
> class(fit2) <- "lme"
> anova(fit1, fit2)
Model df AIC BIC logLik Test L.Ratio p-value
fit1 1 5 1054.623 1071.592 -522.3117
2 6 1113.622 1133.984 -550.8111 1 vs 2 56.99884 <.0001
Unless someone like Doug or Jose tells us, "Don't do that", I
would use these answers.
I looked briefly at the code for "anova.lme", and it
like "glmmPQL" could be added to the list of allowed options in the
following test roughly half way through the code:
if (!all(match(termsClass, c("gls", "gnls", "lm", "lmList",
"lme", "nlme", "nlsList", "nls"), 0))) {
stop(paste("Objects must inherit from classes \"gls\",
\"gnls\"",
"\"lm\",\"lmList\", \"lme\",\"nlme\",\"nlsList\", or
\"nls\""))
}
hope this helps. spencer graves
A.J. Rossini wrote:
For better or worse, it's holidays in the states. Very
me being in a non-Thanksgiving celebrating country.
In addition, it's not a problem. The complaint is valid.
no one has coded up the right solution yet for comparison.
I can't recall if one would want those statistics for a binomial
random effects model, but I do recall some issues with model
comparison in that setting, though they are a bit dated
or so).
On Fri, 26 Nov 2004 09:31:40 +0700, Andrew Criswell
<r-stats at arcriswell.com> wrote:
Hello:
Will someone PLEASE help me with this problem. This is the third
time I've posted it.
When I appply anova() to two equations estimated using glmmPQL, I
get a complaint,
Error in anova.lme(fm1, fm2) : Objects must inherit from classes
"gls", "gnls" "lm","lmList", "lme","nlme","nlsList", or "nls"
The two equations I estimated are these:
fm1 <- glmmPQL(choice ~ day + stereotypy,
+ random = ~ 1 | bear, data = learning, family =
binomial)
fm2 <- glmmPQL(choice ~ day + envir + stereotypy,
+ random = ~ 1 | bear, data = learning, family =
binomial)
Individually, I get results from anova():
numDF denDF F-value p-value
(Intercept) 1 2032 7.95709 0.0048
day 1 2032 213.98391 <.0001
stereotypy 1 2032 0.42810 0.5130
numDF denDF F-value p-value
(Intercept) 1 2031 5.70343 0.0170
day 1 2031 213.21673 <.0001
envir 1 2031 12.50388 0.0004
stereotypy 1 2031 0.27256 0.6017
I did look through the archives but didn't finding
to my problem.
Hope someone can help.
ANDREW