[R-sig-ME] [ADMB Users] Anova table for glmm.admb objects
Ben Bolker
bbolker at gmail.com
Mon Mar 26 18:12:28 CEST 2012
On 12-03-26 10:37 AM, Paula Rosewarne wrote:
>
> Dear All,
>
> I came across this posting (below) on a different list- how to get an
> Anova table from glmm.admb model objects- but I cannot get the
> car::Anova function to work for my model, or for the owl example I
> worked through from the glmmadmb package help notes, so I am guessing
> my code is wrong
>
> When I tried it with the owl example I get the following message, the
> same as when I try for my model:
>
>> car::Anova(fit_zipoiss)
> Error in data.frame(df, teststat, p) : arguments imply differing
> number of rows: 5, 6 In addition: Warning message: In Ops.factor(1,
> Nest) : | not meaningful for factors
>
>
>
> (I am using glmm.admb v0.7.2.4)
>
>
>
> Please could you advise, many thanks,
>
> Paula
>
[cross-posted to ADMB users and r-sig-mixed because I didn't want to
write it twice]
Before I answer the question I want to strongly caution people about
using the Anova() (Wald) tests on glmmADMB output. I am generally of the
"give people the tools, let them do what they want" [in other words
"give them enough rope"] philosophy (which is why I tweaked glmmADMB to
allow car::Anova() to work), but Wald tests are the most approximate
approach to model comparison and inference. For vanilla (non-mixed)
linear models they are identical to standard marginal F tests, but for
mixed/generalized/zero-inflated models they are sometimes very poor
approximations. Using anova() on alternative models instead gives a
likelihood ratio test, which is still approximate but is generally much
better (it relies on the normality of the likelihood itself, rather than
on the normality of the sampling distribution of the parameters). It is
a bit tedious to use in glmmADMB at the moment because I haven't got the
drop1() functionality working yet, but it should be much more reliable.
Even that is not perfect, though, because it does depend on the
approximate normality of the likelihood estimate; MCMC and parametric
bootstrap approaches are more accurate.
You need at least version 0.7.2.9. I am currently struggling to get
the newest version to build properly on r-forge; in the meantime, below
is a helper function to check which versions are available where. You
may want to use the optional argument type="source" (as documented at
http://glmmadmb.r-forge.r-project.org) ...
In the meantime I've put 0.7.2.10 (source only, use type="source") at
the bolker-mcmaster repository and on the alternative r-forge location
(where it should show up within 24 hours).
## helper function to check availability
favail <- function(repos="r-forge.r-project.org",
pkg="glmmADMB",
...) {
hdr <- "http://"
if (!substr(repos,1,8)==hdr) repos <- paste(hdr,repos,sep="")
a <- available.packages(contriburl=contrib.url(repos),...)
if (length(grep(pkg,rownames(a)))==0)
stop(sprintf("%s unavailable at repos %s",pkg,repos))
a[pkg,"Version"]
}
favail() ## unavailable
favail("www.math.mcmaster.ca/bolker/R") ## 0.7.2.10
favail("glmmadmb.r-forge.r-project.org/repos") ## 0.6.4
>
>
> From the r-sig-mixed-models list: Le 20/03/2012 22:43, Ben Bolker a
> écrit : On 12-03-20 02:32 PM,
>> Thomas Merkling wrote:
>>>>> Dear Ben and other list members,
>>>>>
>>>>> - Is there any way to produce a Anova/deviance table for a
>>>>> model fitted with glmmADMB ? I used the Anova() function
>>>>> from the car library for glmer models, but it does not seem
>>>>> to work with glmmadmb (I'm using glmmADMB 0.7) and I would
>>>>> like only one p-value for each term and interaction and NOT
>>>>> one p-value for each level of the interaction.
> Ben's reply:
>> car::Anova() should work now -- I had to add a model.frame() and a
>> df.residual() method for glmmadmb objects. (The df.residual number
>> may be a little dodgy -- I'm not sure I counted the parameters
>> right -- but I don't think it's actually used for much by default,
>> cause you get Wald chi-square tests)
>
>
>
>
> Paula Rosewarne, PhD researcher, Faculty of Biological Sciences
> Manton Building 8.17 Clarendon Way University of Leeds LS2 9JT UK
>
> Email: bspjr at leeds.ac.uk<mailto:bspjr at leeds.ac.uk>
> _______________________________________________ Users mailing list
> Users at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/users
More information about the R-sig-mixed-models
mailing list