Please also provide the following information in addition to your question:
Operating System: Windows10
brms Version: 2.9.0
Hi. I am rather new to brms and trying to fit models with spatial autocorrelation. It is my understanding that CAR and SAR require spatial information as areal units whereas I’d like to model the covariance of observations as a distance (i.e. continuous variable) between the locations. I have two questions: 1) can I fit spatial autocorrelation using distance between the locations in brms, and 2) is there a way in brms to test autocorrelation in residuals in the first place? Thank you.
CAR and SAR models are extensively discussed in the literature. For instance, you can learn more about CAR models by reading the two case studies linked to in ?cor_car and you can read more about spatial weights matrices used in SAR models under ?spdep::listw2mat.
Testing whether residual autocorrelation exists is possible by comparing the models with and without those autocorrelations using, for instance, loo().
Sorry for tagging on so late, for anyone else looking for a way to measure spatial auto-correlation you may want to use a Moran plot, the Moran coefficient, or APLE, the last one being an approximate profile‐likelihood estimator of the spatial auto-correlation parameter from an SAR model (simultaneous auto-regressive). You can find these in the spdep R package. Generally, if you’ve modeled all the spatial auto-correlation in your data, then the Moran coefficient for your residuals (using the posterior mean of the fitted values for example) will be slightly negative.