Paper and R package for spatial models

Hi everyone,

I’d like to share some work on spatial models in Stan recently published in Spatial Statistics

The paper is on eigenvector spatial filter (ESF) models (known as principal coordinates of neighbor matrices (PCNM) in ecology), which estimate a spatially varying intercept (or map pattern) by introducing a bunch of the eigenvectors of a transformed spatial connectivity matrix into a GLM. The trick is to estimate the coefficients of all these synthetic map patterns, which is usually approached as a variable selection problem.

The paper I link to there uses the regularized horseshoe (RHS) prior to estimate those coefficients (rather than select/drop eigenvectors). Thanks @jpiironen and @avehtari! The number of important eigenvectors is largely a function of the degree of auto-correlation in the outcome variable, so setting the hyper-priors for the RHS prior is in many cases quite easy.

I put these models into an R package called geostan.

My goal is to make the package accessible to researchers who are somewhat experienced with R but new to spatial models, or who are new to Bayesian modeling. I borrowed heavily from rstanarm for syntax and default priors (hopefully in a good way?), and also put in options for using intrinsic auto-regressive and BYM2 models following Stan code from @mitzimorris

If anyone’s interested in trying out the package, I’d love to hear your feedback.

I’m sure from a development standpoint there are a bunch of .stan files that should be combined, but I’ve been dreading that task.