[R] MCMC glmm

Ben Bolker bbolker at gmail.com
Mon Feb 14 22:24:04 CET 2011


garciap <garciap <at> usal.es> writes:

> I'm working with abundance data of some species, but containing too zero
> values, and the factors are the ones typical in a BACI experiment
> (Before-and-After-Control-Impact). Thus, these are two fixed factors. As the
> data does not holds the normality and homogeneity of variances assumptions
> of clasiccal ANOVA, I'm trying to fit a zero-altered model using the MCMC
> glmm library.
> I've two questions:
> 
> 1.- how I can include an interaction between the BA (before and after) and
> the CI (control-impact) components in this kind of models? I'm searching in
> the notes available in the models but found no clear answer. My first
> approach to this wil be to wrote a formula like: Abundance~BA+CI+BA*CI.
> 2.- Even when I try to fit a model without interactions I can't do it
> because I obtain the following error:
> > fit<-MCMCglmm(Abundancia~BA+CI, random=NULL,
> > family="zapoisson",data=Trucha)
> Error in MCMCglmm(Abundancia ~ BA + CI, random = NULL, family = "zapoisson", 
> : 
>   please use idh(trait):units or us(trait):units or trait:units for error
> structures involving multinomial data with more than 2 categories or
> zero-infalted/altered/hurdle models

  Quick, not necessarily complete answers:

 (1) BA*CI (which is equivalent to BA+CI+BA:CI) is the right
syntax for the before-after by control-impact interaction.

 (2) MCMCglmm fits zero-altered models by constructing an augmented
set of response variables + predictor variables. This is a little 
tricky: I strongly recommend that you look at p. 100 and following of
 vignette("CourseNotes",package="MCMCglmm") and come back with
further questions after you've read it ...
  As mentioned therein, if you don't have random effects then it
will be considerably easier to fit your model using the functions
in the pscl package.



More information about the R-help mailing list