Codes associated with the paper "Fine-scale interplay between decline and growth determines the spatial recovery of coral communities within a reef". (https://doi.org/10.1111/ecog.06818)
The model runs using the R package INLA (Rue et al. 2009).
First, download the repo on your local machine and open the file "spatio-temporal_modelling.Rproj" from RStudio. Install the required R packages and run the script entitled "model_run.R".
(Note that the model fit is not satisfying in this example because it is using a low number of data locations to speed the model computation. See Supplementary Material "Details on spatio-temporal modelling" to see model fit and other model diagnostics for more information.)
Reference:
Havard Rue, Sara Martino, and Nicholas Chopin (2009), Approximate Bayesian Inference for Latent Gaussian Models Using Integrated Nested Laplace Approximations (with discussion), Journal of the Royal Statistical Society B, 71, 319-392.