[R-sig-ME] Prediction from Poisson MCMCglmm model fails
Chris Oosthuizen
w@chr|@@oo@thu|zen @end|ng |rom gm@||@com
Wed Jun 14 00:08:21 CEST 2023
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]]
More information about the R-sig-mixed-models
mailing list