[R-sig-ME] Zipoisson MCMCglmm for abundance data

Jarrod Hadfield j.hadfield at ed.ac.uk
Tue Nov 27 14:49:38 CET 2012

Dear Dani,

1/3b You need to drop at.level(trait,1):location from the fixed model  
as you have it in the random part of the model (although this may just  
be a typo).  I would also have trait-1 as you do not want the  
intercept for the Poisson process and the zero-inflation to be the same.

2. If you have many observations per species then I would put a  
non-phylogenetic species effect in too. If there are few (at the  
limit, only one) then it may be hard to separate the phylogenetic from  
the non-phylogenetic.

3a. this looks fine but make sure to put mesd in dat0.phyl (I presume  
this is the case otherwise MCMcglmm should spit an error, if it did  
not please tell me). Not sure how effort is measured, but you may not  
expect a linear relationship between 1/(effort) and the measurement  
error variance of the counts on the log scale. (I presume ** should be  
^ in your code)

4. With  the 2x2 "idh" structure on the residuals I would use nu=0.002  
rather than nu=1.002. Only with a 2x2 "us" structure is the degree of  
belief for the marginal distribution of a single variance 0.002 when  
specifying nu=1.002. Parameter expanded priors might also be  
entertained for the random effect variances. They will also improve  
mixing if the varinaces are close to zero.



Quoting Daniel Sol <dsolrueda at gmail.com> on Tue, 27 Nov 2012 14:07:45 +0100:

> Hi everybody,
> I'm trying to model species abundances and I have some doubts about
> how to fit my model with MCMCglmm.
> My aim is to test whether the abundance of species in urban habitats
> (variable "abund.urb") is associated with their density in the
> surrounding habitats (variable "dens.surr", log+0.5 transformed) with
> a dataset of 22 localities. The response variable (variable
> "abund.urb") is zero-inflated, so a zipoisson stucture of errors seems
> to be a good option. To model this response variable, I need to take
> into account the likely non-independence of observations coming from
> the same location (variable "location") and the same species (variable
> "animal", as some species are found in more than one locality). I also
> need to include phylogenetic corrections (phylo object "tree") and
> take into account that the sampling effort (variable "effort") vary
> between locations. The script is shown below.
> zi.prior <-  list(R = list(V = diag(2), n = 1.002, fix = 2),
> 			  G = list(G1 = list(V = 1, n = 0.002),
> 		  	  G2 = list(V = 1, n = 0.002),
> 		              G3 = list(V = 1, n = 0.002)))
> mev <-1/(effort)
> mesd <- (mev)**0.5
>    m2 <- MCMCglmm(abund.urb ~ -1 +
> at.level(trait,1):log(dens.surr+0.5) +  	at.level(trait,1):location,
> 	random = ~idh(at.level(trait,1)):location +
> idh(at.level(trait,1)):animal + us(mesd):units,
> 	rcov = ~ idh(trait):units,
> 	data = dat0.phyl, family = "zipoisson", prior = zi.prior,
> 	pedigree=tree,
> 	verbose = TRUE, pr = FALSE, pl = FALSE)
> I would appreciate help in the following questions:
> 1. Does the model look appropriate?
> 2. How can I transform the model to allow slopes (in addition of
> intercepts)  to vary at random within localities? I have made several
> attempts but they do not work.
> 3. Is the use of "animal" as random factor enough to control for
> repeated species data, or I also have to add an additional random
> factor coding for each species.
> 3. Is the estimated of "med" correct?
> 3. Should I use trait-1 or simply -1?
> 4. Are there other priors that would be worth testing?
> I'm new in using MCMCglmm so any help is appreciated.
> Many thanks in advance,
> Dani
> --
> Daniel Sol
> CREAF (Centre for Ecological Research and Applied Forestries)
> CSIC (Centre for Advanced Studies of Blanes-Spanish National  
> Research Council)
> Autonomous University of Barcelona, Bellaterra, Catalonia E-08193, Spain
> TEL: +34 93-5814678
> FAX: +34 93-5814151
> E-MAIL: d.sol at creaf.uab.es
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

More information about the R-sig-mixed-models mailing list