Spatial Bayesian Inference

Statistics
Introduced by
Besag, York & Mollie (CAR prior, 1991); Gelfand & colleagues (Bayesian geostatistics, 1990s)
Year
1991
Type
Bayesian hierarchical spatial model
Family
Bayesian / computational

What does it do?

Spatial Bayesian inference applies Bayesian hierarchical modeling to outcomes indexed by geographic location.

A structured spatial prior is placed on location-specific random effects, so each location's estimate is informed by its neighbours or nearby points. The result is a posterior distribution for every location, which supports smoothed maps with quantified uncertainty for quantities such as disease rates, pollution levels, or species abundance.

The intuition behind the method

Nearby places tend to be more similar than distant ones, an idea often stated as Tobler's first law of geography. Spatial Bayesian inference formalises this by placing a prior that couples the effects of neighbouring locations, so that data from one area inform the estimates for its neighbours. The output is a posterior distribution for each location's parameter, which allows maps with uncertainty bands. Where local data are sparse, the spatial prior pulls estimates toward their geographic neighbours instead of leaving them unstable.

History

Bayesian spatial modelling took a form close to its current one with the 1991 paper by Besag, York and Mollié, an early Bayesian treatment of spatial priors with two applications in spatial statistics. Bayesian geostatistics, which extends hierarchical modelling to point-referenced data, is set out systematically in Banerjee, Carlin and Gelfand (2015), a standard reference for the field. The approximate inference method INLA later made fitting large latent Gaussian spatial models practical for routine use.

When to use it

Choose spatial Bayesian inference when outcomes are observed at geographic locations and neighbouring locations plausibly share unmeasured influences, as in disease mapping, environmental monitoring, or ecological modelling. It is most useful when some areas have little data, because the spatial prior stabilises their estimates, and when decisions require calibrated uncertainty for each location, such as exceedance probabilities. Do not use it when there is no evidence of spatial dependence after accounting for covariates, when a simpler non-spatial model answers the question, or when the areal boundaries are arbitrary enough that conclusions would change under plausible redefinitions. The model described on this page covers areal and point-referenced data; point-process data require a formulation that this page does not describe.

Limitations and considerations

  • Full MCMC becomes slow as the number of areas or locations grows, because the spatial random effects are high-dimensional; INLA is faster but applies only to models in the latent Gaussian class.
  • The spatial weight matrix W (for the CAR prior) or the covariance function (for a Gaussian process) defines the dependence structure, so results depend on this choice and require sensitivity analysis.
  • For areal data, the modifiable areal unit problem means that estimates and clusters can change when the same data are aggregated to different boundaries.
  • The spatial precision and range hyperparameters are often weakly identified from the data, so their posteriors can stay close to their priors unless the priors are chosen with care.
  • The model assumes that observations are conditionally independent given the latent spatial field, that the chosen outcome distribution and link function are appropriate, and that the spatial term is not confounded with unmeasured covariates. A Gaussian process additionally assumes stationarity and, where the covariance depends only on distance, isotropy.
  • The intrinsic CAR prior is improper, so a sum-to-zero constraint or a proper parameterisation must be imposed before the model is fitted.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • The random effect phi is pulled toward the values of its neighbours by the spatial prior, which stabilises estimates for areas with few observations.
  • Each location receives a full posterior distribution, so uncertainty maps and exceedance probabilities follow directly from the fitted model.
  • Covariate effects beta and spatial dependence phi are estimated jointly in one hierarchical model, so the covariate estimates are adjusted for residual spatial structure.
  • The same hierarchical framework extends to space-time, multivariate, and non-Gaussian outcomes.
  • Posterior predictive checks and model comparison criteria (WAIC, LOO, DIC) can be computed from the posterior samples or the approximation.

Applications

  • Disease mapping: estimating smoothed disease rates across regions with sparse counts, such as cancer atlases.
  • Environmental monitoring: interpolating pollution or climate variables at unobserved locations from sparse sensor networks.
  • Ecology and species distribution modeling: mapping habitat suitability while accounting for spatial autocorrelation.
  • Crime analysis: identifying spatial clusters of incidents while controlling for neighborhood-level covariates.
  • Agricultural yield mapping: predicting field-level crop yields from spatially referenced soil and weather data.
  • Epidemiology: detecting disease clusters and estimating spatially varying risk factors for public health policy.

How it works

How it works

1

The prior encodes spatial dependence in the random effect phi. For areal data (regions, counties) the standard choice is the conditional autoregressive (CAR) prior, in which each area's effect is conditionally Gaussian given its neighbours' effects, with the scale set by tau squared and the neighbourhood set by the weight matrix W. Besag, York and Mollié (1991) is an early Bayesian treatment of spatial priors of this kind, with two applications in spatial statistics. For point-referenced data, a Gaussian process is used, with a covariance function C(s, s'; theta) that decays with distance. The hyperparameters (tau squared for the CAR prior, and the range and variance parameters within theta for the Gaussian process) are themselves given priors and estimated from the data.

Formula
\phi \sim \mathrm{CAR}(W, \tau^2) \quad \text{or} \quad \phi(s) \sim \mathcal{GP}(0, C(s,s';\theta))
2

Each observation y_i is modelled with a distribution f whose mean mu_i is linked to a linear predictor through a link function g, so that g(mu_i) = X_i beta + phi_i. The fixed effects beta capture covariates, and phi captures residual spatial dependence not explained by them. The choice of distribution and link depends on the outcome: a Poisson distribution with a log link suits counts, a binomial distribution suits proportions, and a Gaussian distribution suits continuous outcomes.

Formula
y_i \mid \mu_i \sim f(\mu_i), \quad g(\mu_i) = X_i\beta + \phi_i
3

Bayes' rule combines the likelihood, the spatial prior for phi, and the priors on beta and theta into a joint posterior over beta, phi, and theta. For most spatial models this posterior has no closed form, so it is either sampled with MCMC or approximated with Integrated Nested Laplace Approximation (INLA), a method designed for latent Gaussian models.

Formula
p(\beta, \phi, \theta \mid y) \propto p(y \mid \beta, \phi)\, p(\phi \mid \theta)\, p(\beta)\, p(\theta)
4

Posterior samples are generated with MCMC. Gibbs sampling can be used where the full conditional distributions of the parameters have a known form, which holds for some of the Gaussian components, while Hamiltonian Monte Carlo (for example the NUTS sampler in Stan) handles more general spatial models. INLA provides a deterministic approximation that is typically much faster for models in the latent Gaussian class. MCMC convergence is checked with R-hat, effective sample size, and trace plots, and an INLA approximation should be checked against MCMC on a smaller example before its results are interpreted.

5

From posterior samples or the INLA approximation, summaries are computed for each quantity of interest: posterior means and 95% credible intervals for fixed effects, smoothed risk maps with uncertainty, and exceedance probabilities, meaning the posterior probability that a region's rate exceeds a policy-relevant threshold. Posterior predictive checks test whether the model reproduces the observed spatial pattern.

Common pitfalls

  • Skipping residual checks after fitting: Moran's I on the residuals should be inspected for remaining spatial autocorrelation.
  • Adopting a binary adjacency matrix by default when distance gradients are expected to matter, without justification; the weight matrix shapes the prior and therefore the smoothed map.
  • Interpreting maps before verifying MCMC convergence or the accuracy of an INLA approximation.
  • Reading spatial random effects as causal mechanisms; a spatially structured residual indicates unexplained structure, not a cause.
  • Committing the ecological fallacy by interpreting area-level estimates as statements about individuals within those areas.

Frequently asked questions

What is a CAR prior and when should I use it?

A conditional autoregressive (CAR) prior is a Gaussian Markov random field that makes each area's latent effect conditionally dependent on its neighbors' effects. Use it for areal (polygon) data — administrative regions, census tracts, grid cells — where adjacency defines neighborhood structure. For point-referenced data with exact coordinates, a Gaussian process with a distance-decay covariance function is more appropriate.

Should I use MCMC or INLA for spatial models?

INLA (via R-INLA) is fast and is commonly used for latent Gaussian spatial models, including many routine disease-mapping and geostatistical interpolation tasks. Full MCMC (e.g., via Stan) is preferable when the model falls outside the latent Gaussian class or when exact posterior samples are needed. Whichever method is used, check the INLA approximation against MCMC on a smaller example before interpreting its results.

How do I account for both spatial autocorrelation and covariates simultaneously?

Include fixed effects for observed covariates in the linear predictor alongside spatially structured random effects. The random effects capture residual spatial autocorrelation unexplained by the covariates. After fitting, check that Moran's I on the posterior mean residuals is near zero; persistent autocorrelation signals model misspecification.

What is an exceedance probability map and why is it useful?

An exceedance probability map shows, for each location, the posterior probability that its quantity of interest exceeds a policy-relevant threshold. Because Bayesian inference produces a full posterior for each location, these probabilities are a natural output and are more decision-relevant than point-estimate maps alone.

How does spatial Bayesian inference differ from spatial lag or spatial error regression?

Frequentist spatial regression (spatial lag or error models) provides point estimates with asymptotic standard errors. Spatial Bayesian inference produces full posterior distributions, enables principled information-borrowing through hierarchical priors, handles small-area estimation naturally, and allows complex extensions (space-time, multivariate) in a unified probabilistic framework.

Related methods

Sources

  1. Banerjee, S., Carlin, B. P. & Gelfand, A. E. (2015). Hierarchical Modeling and Analysis for Spatial Data (2nd ed.). CRC Press.

    ISBN: 978-1439819173
  2. Besag, J., York, J. & Mollie, A. (1991). Bayesian image restoration, with two applications in spatial statistics. Annals of the Institute of Statistical Mathematics, 43(1), 1-20.

    Open DOI reference