[R-sig-ME] Prediction from Poisson MCMCglmm model fails

Jarrod Hadfield j@h@d||e|d @end|ng |rom ed@@c@uk
Wed Jun 14 10:29:17 CEST 2023


Hi Chris,


You have marginalised the site effects in the prediction. Having marginal=NULL will fix the problem and glmer and MCMCglmm will give very similar answers. Also, better to use posterior="all" and not that having interval="prediction" rather than interval="confidence" will give different intervals than lmer, although the point estimates should still be comparable.

Note however that a difference between the glmer and MCMCglmm model is that the latter has an observation-level random effect (rcov=~units) which deals with any overdispersion, whereas the glmer model does not (but one could be fitted, and is generally recommended). Since the simulations do not have any overdispersion (although real data is very much likely to have some) this may create some issues with the residual variance being stuck at zero without a prior. Having the prior

prior=list(R=list(V=1, nu=0.002), G=list(G1=list(V=diag(2), nu=2, alpha.mu=c(0,0), alpha.V=diag(2)*100)))

should remedy this.

Cheers,

Jarrod

From: R-sig-mixed-models <r-sig-mixed-models-bounces using r-project.org> on behalf of Chris Oosthuizen <w.chris.oosthuizen using gmail.com>
Date: Tuesday, 13 June 2023 at 23:09
To: r-sig-mixed-models using r-project.org <r-sig-mixed-models using r-project.org>
Subject: [R-sig-ME] Prediction from Poisson MCMCglmm model fails
This email was sent to you by someone outside the University.
You should only click on links or attachments if you are certain that the email is genuine and the content is safe.

Dear list,

I simulated the population trends of 26 populations over 60 years. Each
population (site) was counted once every year. The population growth rate
(lambda) correlates with a site's latitude. Each site only has one unique
latitude value associated with it.

I want to fit a mixed model to predict the population count every year. I
am using the simulated data as a test case for real data. I can predict
perfectly well after fitting a glmer (lme4) model. I cannot get it to work
with MCMCglmm.

I have a few questions relating to coding this model (data and code link
below):

1) Could someone please help me to diagnose the problem with MCMCglmm? I
(naively) assume that MCMCglmm will select a 'good enough' prior in
the code (see link below). I did not specify a prior here because I am not
fully understanding that syntax as yet, and when I did specify a prior the
model also gave poor output.

2) Am I correct that the random effect structure for these models are the
same?
m1 = glmer(count ~ year0 + latitude0 + (year0|site), family = "poisson",
data = df)
mc1<-MCMCglmm(count ~ year0 + latitude0, random=~us(1 + year0):site,
              rcov=~units, family="poisson", data = df)

3) What is the optimal model structure?  The hypothesis is that lambda
(i.e., the slope of the count~year regression) is associated with latitude
(which is unique for sites).

I fit the model like this, but it doesn't predict well:
mc1 <- MCMCglmm(count ~ year0 + latitude0, random=~us(1 + year0):site,
                  rcov=~units, family="poisson", data = df)

I have seen this model in print for a similar problem:
mx <- MCMCglmm(count ~ year0, random=~us(1 + latitude0):site,
                rcov=~units, family="poisson", data = df)

I don't agree with the random effect structure: should 'year' not also be a
random slope? Perhaps year and latitude as random slopes?

The simulated data and R code is available here:
https://drive.google.com/drive/folders/1ilKWSCLcrzL_FDrtEubNcm6X__ta1E0T?usp=sharing

Thank you,
Chris

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-mixed-models using 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. Is e buidheann carthannais a th' ann an Oilthigh Dh?n ?ideann, cl?raichte an Alba, ?ireamh cl?raidh SC005336.

	[[alternative HTML version deleted]]



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