[R-sig-ME] Predicting the overall population trend from a GLMM with many sites (MCMCglmm)

Chris Oosthuizen w@chr|@@oo@thu|zen @end|ng |rom gm@||@com
Thu Sep 14 17:05:09 CEST 2023


Dear all,

I have intermittent population counts of a single species at many sites
that are situated at different latitudes. I want to estimate the overall
population trend across all sites (how much did the overall population
decline in 30 years?). I would appreciate clarification on precisely how I
should calculate a single, overall population trend estimate from a
random-slope mixed model.

The model we fit is:
model <- MCMCglmm(count ~ year * latitude, random = ~us(1 + year):site,
                rcov=~units, family="poisson", pr = T, data = df…)

If I were interested in site-level effects I would predict with random
effects (set marginal to NULL):
pred <- data.frame(predict(model, newdata=df, type="response",
marginal=NULL, interval="confidence", posterior="all"))

We can also marginalise the random effects – this prediction is “at the
population level” and it may have poor site-level predictions if the random
effect is important (e.g. some sites are increasing and others are
decreasing):
pred_margin <- data.frame(predict(model, newdata=df, type="response",
marginal=model$Random$formula, interval="confidence", posterior="all"))

Both predictions above are made using a ‘newdata’ data frame that contains
‘site’ – this seems to be required by the ‘predict’ function. Thus, we
always end up with site-level data as output in the prediction data frame,
regardless of whether the random effects were marginalised or not.

I don’t know the best statistical approach to obtain a single population
trend estimate. My approach would be to predict with random effects, and
sum the counts per site to get an overall estimate. This is the approach
that a colleague took (although he disregarded the random effects). His
calculations do not use the ‘predict’ function, but directly calculates
population sizes from the model coefficients, for every posterior draw (to
propagate uncertainty). He then estimates population sizes at two points
(in 1990 and 2020) and asks whether the population decreased between these
two points.
This approach and reproducible code is here:
https://drive.google.com/drive/folders/1_thQQW9Vy3SxGi6WBkk-1CuqSpE6XaYy?usp=sharing

It is important that I get this right, so I hope someone can give me
guidance. Thanks in advance!
Chris

	[[alternative HTML version deleted]]



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