Conditional AutoRegressive ("CAR") models are just about the simplest possible way of accounting for spatial autorcorrelation. It is essentially the analogue of the temporal ARIMA type models but in space. It is arguably even simpler as the units of space are discrete areal units (arbitrary polygons). Originally it was formulated in lattice form and related to the Ising models in physics. Its use is most prevalent in epidemiology made accessible by the original Besag-York-Mollie paper, Leroux and Riebler, and many others.
This R implementation is actually a simple front-end to INLA (see below) with simple data structure expectations to permit multiply chained projects (dependencies such as bathymetry -> temperature -> abundance of snow crab). The documentation of methods and examples can be found in:
./inst/scripts/example_temperature_carstm.md
and various aegis*. and bio.snowcrab packages make heavy use of it.
The R project is basically an accounting front-end to the computational engines (INLA, sf) to facillitate the computing, storage and access to the results of these models. Relatively simple to do for a simple spatial model without CARSTM, however, in spatio-temporal models, a bit of a challenge. This tool is mostly written to facilitate my work flow to estimate relationships and predict in a Bayesian spatiotemporal context.
An example of a real use case that fully shows the space-time-seasonal approach here: modelling ocean bottom temperature near Halifax, Nova Scotia, with season discretized to 10 units (to improve data density).
As it operates with other aegis.* projects, each of the following are modelled and becomes accessible as covariates: ocean depth (aegis.bathymetry), ocean substrate grain size (aegis.substrate), ocean bottom temperature (aegis.temperature), demersal species composition (aegis.speciescomposition), Snow crab numerical abundance, size and probability of observation to estimate viable habitat (bio.snowcrab), and extentions to cod abundance, number, size and habitat (aegis.survey), etc. Many other variables require spatiotemporal modelling (e.g., physiological condition of fish, system-level metabolism) and are planned for one of these days.
The dynamic modelling is limited to basic statistical modelling and is not able to compute latent state space models (yet). Currently use of Julia/Turing/Differential Equations/SciML poses a serious risk of making these really interesting questions viable ...
In the project aegis.survey, you will find a sequence of examples using CARSTM with supporting functions that examines abundance estimation of snow crab and groundfish (Atlantic cod) in Maritimes groundfish survey strata. The approach is easily generalizable to all species. The main sequence of example models and scripts are found in inst\scripts* for the projects: bio.snowcrab and aegis.surveys, and leverages the https::\github.com\jae0\aegis data and GIS handing routines.
For Atlantic cod, see the preprints at:
Use in estimating an abundance index of Atlantic Cod
Use in decomposing environmental effects for Atlantic Cod
Use in decomposing environmental effects for Snow Crab
Another (less interesting) usage of CARSTM is to replicate the "standard" analysis used by DFO Maritimes (known as "stratanal"): a really basic stratified average estimate. This is shown to be equivalent to a Gaussian linear fixed effects model. The utility becomes evident as this model-based approach can be used to incrementally improve upon the assumptions of the basic model, focussing upon the distributional assumptions of the model (Poisson, overdispersed Poisson), adding environmental covariates and then employing an INLA-based ICAR (intrinsic conditionally autoregressive models; "bym2") approach towards accounting for areal unit modelling and an AR1 temporal autocorrelation assuming separability of the spacetime autocorrelation. See this document for more details and notes.
To install, run the following:
remotes::install_github( "jae0/aegis") # helper functions
remotes::install_github( "jae0/carstm")
You probably will want to have an Rprofile set up properly such as:
homedir = path.expand("~")
code_root = file.path( homedir, "bio" ) ### replace with correct path to the parent directory of your git-projects
data_root = file.path( homedir, "bio.data" ) ### replace with correct path to your data
require( aegis )
require( carstm )
Mitzi Morris: https://mc-stan.org/users/documentation/case-studies/icar_stan.html (very thorough)
Max Joseph: Exact sparse CAR models in Stan: https://github.com/mbjoseph/CARstan
https://github.com/ConnorDonegan/Stan-IAR https://github.com/ConnorDonegan/survey-HBM#car-models-in-stan
https://www.mdpi.com/1660-4601/18/13/6856
Besag, Julian, Jeremy York, and Annie MolliƩ. "Bayesian image restoration, with two applications in spatial statistics." Annals of the institute of statistical mathematics 43.1 (1991): 1-20.
Gelfand, Alan E., and Penelope Vounatsou. "Proper multivariate conditional autoregressive models for spatial data analysis." Biostatistics 4.1 (2003): 11-15.
Jin, Xiaoping, Bradley P. Carlin, and Sudipto Banerjee. "Generalized hierarchical multivariate CAR models for areal data." Biometrics 61.4 (2005): 950-961.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.