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

Jarrod Hadfield j@h@d||e|d @end|ng |rom ed@@c@uk
Thu Sep 14 17:29:08 CEST 2023


HI,

Using marginal= ~us(1 + year):site in the predict function does not marginalise sites it marginalises *site effects*: the prediction will stary vary across sites because the sites will be at varying latitudes and latitude has not been marginalised.

On the data scale, the relationship between the expected count and year is not linear and so I think it is easier to work on the link (log) scale where the relationship is linear. On this scale the mean slope is simply

b1+b2*mean(latitude)

where b1 is the main effect of year, and b2 the year by latitude interaction.

If you want to work with the average of the exponentiated slopes (i.e. the expected proportional change in abundance per year) this would require more work, but I�m not sure that is what you want?

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: Thursday, 14 September 2023 at 16:06
To: r-sig-mixed-models using r-project.org <r-sig-mixed-models using r-project.org>
Subject: [R-sig-ME] Predicting the overall population trend from a GLMM with many sites (MCMCglmm)
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 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]]

_______________________________________________
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