Prioritization of allocating variation explained between BYM2 and other random effect

16 views
Skip to first unread message

Caroline

unread,
Sep 24, 2025, 1:11:48 PM (9 days ago) Sep 24
to R-inla discussion group

I am fitting a model with a BYM2 random effect and testing the effects of environmental variables that are expected to have non-linear responses, using second-order random walk terms (e.g., temperature in relation to disease risk).

When including variables as fixed effects, my understanding is that variation is first attributed to the fixed effect and the BYM2 term then accounts for the remaining “leftover” spatial variation. My question is: if focal covariates are instead modeled as random effects (to capture non-linear relationships), how is the variation partitioned? Is it primarily allocated to the random-walk term first, since it is lower-dimensional and less complex than the BYM2 term?


Finn Lindgren

unread,
Sep 24, 2025, 2:50:09 PM (9 days ago) Sep 24
to R-inla discussion group
Hi,
In some cases one may be able to interpret the combination of effects in such ways, but not in general. The idea behind PC-prior can help, as they can be motivated in a sequential fashion, by discouraging the model from increasing complexity. But this is more motivational, and in general one might not be able to separate the contributions like that, since they will be confounded with each other in different ways, e.g. depending on what constraints, if any, are imposed. For example, Linear+rw2 is only fully identifiable if a sum-to-zero _and_ average-slope-is-zero constraints are imposed on the rw2 component. And even then, the specific choice of constraint is not unique.
E.g., by dropping the linear term and the slope-zero constraint, one gets the same model (up to details on the prior for the linear term). This is also the default for rw2 in inla.

How much variability will end up being “explained” by each separate component depends both on the observations and the combination of prior distributions on all the model parameters. Usually, one might expect that the more complex part of the model would become small unless the data says it’s required, but that is not a universal truth.
My preferred approach to answer questions like “how linear is this effect” is to evaluate the posterior properties of the deviation between the full posterior shape of the effect and a linear regression line for that full effect, or to run two models; one simple and one more complex, and comparing the predictive behaviour.

Finn

On 24 Sep 2025, at 18:11, Caroline <ckgl...@gmail.com> wrote:



I am fitting a model with a BYM2 random effect and testing the effects of environmental variables that are expected to have non-linear responses, using second-order random walk terms (e.g., temperature in relation to disease risk).

When including variables as fixed effects, my understanding is that variation is first attributed to the fixed effect and the BYM2 term then accounts for the remaining “leftover” spatial variation. My question is: if focal covariates are instead modeled as random effects (to capture non-linear relationships), how is the variation partitioned? Is it primarily allocated to the random-walk term first, since it is lower-dimensional and less complex than the BYM2 term?


--
You received this message because you are subscribed to the Google Groups "R-inla discussion group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to r-inla-discussion...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/r-inla-discussion-group/e804e41c-d921-4c03-b9e9-1cb47cee37b4n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages