[ADMB Users] [R-sig-ME] Anova table for glmm.admb objects

Ben Bolker bbolker at gmail.com
Tue Mar 27 14:42:03 PDT 2012

  A couple of things.

  (1) can you update.packages() or re-install R2admb and see if that
helps with the R2admb/dat_write problem?

  (2) I would like to recant the Bolker et al decision tree somewhat.
At the time I wrote it, I was somewhat confused (!!!!) about the
distinction between the two difficulties with inference in the GLMM

  * model comparisons are better than curvature-based approaches
  * approaches that allow for finite-sample effects are better than
asymptotic approaches
  * there are two different kinds of finite size issues, one applying
more to LMMs (the residual variance parameter used to scale the
likelihood is estimated with uncertainty, hence we get an F statistic
for the null hypothesis) and the other to GLM(M)s (the 'numerator' of
the likelihood itself is only asymptotically normal)  -- this is
detailed a little more carefully at http://glmm.wikidot.com/faq (search
for "degrees of freedom"

  When we wrote the TREE paper I thought it might be OK to use the
classical experimental design 'denominator df' to correct for
finite-size samples, but I'm no longer sure this is a good idea.  In any
case, car::Anova(glmerfit) gives Wald *CHI-SQUARE* tests (not F tests),
so there's no advantage over drop1() except for computational speed.

  Hope that helps.

  Ben Bolker

On 12-03-27 12:29 PM, Thomas Merkling wrote:
> Dear all,
> I'm a bit confused about last comments from Ben Bolker.
> I read Bolker et al., 2009 TREE and what I remembered is that it was
> advised to use Wald tests instead of LRT whent testing for fixed effects
> (and the contrary when testing for random effects). Hence, I'm surprised
> that Ben just said the contrary: is it just true for glmmADMB or for any
> packages ?
> If we want to use more accurate approaches, but if possible not MCMC
> techniques, are there any possibilities with glmmADMB ?
> I tried to install glmmADMB_0.7.2.10 from  bolker-mcmaster repository,
> but I got the following error message:
> Installation d(es) package(s) dans ‘C:/Users/thomas
> merkling/Documents/R/win-library/2.14’
> (car ‘lib’ n'est pas spécifié)
> * installing *source* package 'glmmADMB' ...
> ** R
> ** data
> **  moving datasets to lazyload DB
> Error : l'objet 'dat_write' n'est pas exporté par 'namespace:R2admb'
> ERROR: lazydata failed for package 'glmmADMB'
> * removing 'C:/Users/thomas merkling/Documents/R/win-library/2.14/glmmADMB'
> * restoring previous 'C:/Users/thomas
> merkling/Documents/R/win-library/2.14/glmmADMB'
> Thanks in advance !
> Thomas
> Le 26/03/2012 18:12, Ben Bolker a écrit :
>> 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  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 (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")  ##
>> 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
> -- 
> Thomas Merkling, Doctorant (PhD Student)
> Web Page <http://www.edb.ups-tlse.fr/Merkling-Thomas.html>
> Laboratoire "Evolution et Diversité Biologique" -EDB
> UMR 5174 - bât 4R1 - bureau 33 RDC
> Université Paul Sabatier Toulouse 3
> 118, route de Narbonne
> 31062 TOULOUSE Cedex O9, FRANCE
> Tél: 33 5-61-55-67-56
> Fax: 33 5-61-55-73-27

More information about the Users mailing list