SPDE Spatial Autocorrelation in areas with high elevation change

27 views
Skip to first unread message

Chris Smith

unread,
Sep 28, 2025, 10:57:16 PM (5 days ago) Sep 28
to R-inla discussion group
Dear INLA google group,
     First, thanks for making such an awesome tool for ecologists out there who struggle with spatial autocorrelation in our studies.  This package recently solved a huge problem I was having with spatial autocorrelation in my data.

My study organism (American Pika) live in mountainous areas with large changes in elevation. For example, within a 1 km distance, I go from 6000 to 10000 ft up the side of a mountain and pika occupancy goes from near 0% probability up to 100%.  My understanding is that SPDE models using a mesh to model autocorrelation assume points that are closer in horizontal distances are more similar. The problem for pika is that for 2 points 1 km horizontally apart (both at 6000ft elevation), this works well. However for 2 points 1km apart at 6000ft and 10000ft, the correlation is extremely different (vs 1 km horizontally). 

I have run preliminary models with the SPDE random effect, while including elevation as a fixed effect, and the predictions seem reasonable.

I wanted to ask:
1) Does adding elevation as a fixed effect help overcome this problem, with horizontal vs vertical spatial autocorrelation?
2)  Are there other tools in INLA I should be using for 3-D autocorrelation?
3) I am worried about putting highly correlated variables like snowpack into models with elevation; do you have any suggestions how to still include correlated climate variables if I am putting elevation in all my models?

I hope this post can be helpful for other researchers working in mountainous ecosystems where elevation change is a major part of our system.
Thanks for any help you can provide.



Finn Lindgren

unread,
Sep 29, 2025, 9:46:38 AM (4 days ago) Sep 29
to R-inla discussion group
Hi Chris,

1)
there are two aspects here that are often confused; coherently spatially changing mean value, and spatial correlation; with just one realisation of the field, one can't really tell those apart, and one has to use ones modelling choices to get the kind of information one is interested in. Sometimes, it's enough to include the covariate in the predictor (i.e. controlling the mean value), but if one truly needs it to control the dependency structure (i.e. to _decouple_ the values at high and low elevation) one needs to enter it as covariates in the dependence structure. In your case, you likely need both.

The inla.sdpe2.matern() model constructor allows you to include covariates evaluated at the mesh nodes, e.g. if elevation is available as a terra raster:

library(inlabru)
elev_on_mesh <- eval_spatial(elevation, mesh$loc)
spde <- inla.spde2.matern(mesh, alpha = 2, B.tau = cbind(0, 1, elev_on_mesh, 0, 0), B.kappa = cbind(0, 0, 0, 1, elev_on_mesh))

This lets both tau and kappa vary across space. Also see https://www.jstatsoft.org/article/view/v063i19 for more details on the parameterisation, and how to reparameterise the model to be more interpretable, in terms of log(std.dev.) and log(range) instead of the less directly interpretable tau and kappa parameters.

The above is just a simple example of how to write the code. In your problem, it's more likely that you want kappa to depend on the magnitude of the _slope_ of the elevation field, so that a large slope allows it to locally have a short correlation length, which has the effect of decoupling areas of low and high elevation. (this would be a "soft" version of the "barrier" model, which is discussed elsewhere)

2) There is support for full 3D tetrahedralisations (fmesher::fm_mesh_3d()), but that is unlikely to be helpful in your case, and is more suited for e.g. 3D seismology etc.

3) If the covariates are highly correlated, then you'll get confounding in the estimates, yes. There's no universal solution to that.
You will be ba able to see in the estimates if it is a problem, e.g. if the effect of each individual component has a large posterior predictive standard deviation, but the combined predictions have reasonable std.ev.; that would mean that the estimates are negatively correlation, which is what one would expect in a confounded situation. (This often happens between the intercept and spde components as well; in those cases, just focus on their combined effect instead of attempting to interpret the individual effects).

Finn

--
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/d51e8c46-b6bb-4aa9-9200-a13e8d626a4en%40googlegroups.com.


--
Finn Lindgren
email: finn.l...@gmail.com
Reply all
Reply to author
Forward
0 new messages