- Introduced by
- Julian Besag, Jeremy York & Annie Mollie (BYM2 by Riebler, Sorbye, Simpson & Rue)
- Year
- 1991
- Type
- Hierarchical Bayesian Poisson model with structured and unstructured spatial random effects
- Family
- Conditional autoregressive (CAR) disease-mapping model
What does it do?
The Besag-York-Mollie (BYM) model is a hierarchical Bayesian model for small-area disease mapping, proposed by Julian Besag, Jeremy York, and Annie Mollie (1991).
It models area-level counts with a Poisson likelihood whose log relative risk is the sum of two random effects: a spatially structured component with an intrinsic conditional autoregressive (ICAR) prior that borrows strength from neighboring areas, and an unstructured component capturing area-specific heterogeneity that is not spatially patterned. Because the original parameterization makes the two variance components hard to interpret and depends on the adjacency graph, Riebler, Sorbye, Simpson, and Rue (2016) introduced the scaled BYM2 reparameterization, which uses one total-variance parameter and one mixing parameter, improving prior specification and identifiability.
The intuition behind the method
Raw disease rates for small areas are jumpy and unreliable: a county with few people can show a frighteningly high rate from just one or two extra cases, purely by chance. We want to separate real geographic signal from this small-number noise. The BYM model does it by assuming each area's risk is pulled by two forces. The first is its neighbors: if an exposure or risk factor varies smoothly across space, adjacent areas should have similar risk, so a structured effect shrinks each area toward the average of the places touching it, stabilizing the estimate by borrowing strength locally. The second force is the area's own idiosyncrasy: some areas are just different in ways that have nothing to do with location, so an unstructured effect lets each area wobble independently around the overall mean. The estimated map is a compromise between trusting the raw count, trusting the neighbors, and trusting the global average, with the data deciding how much weight each force gets. The result is a smoothed risk surface that reveals true clustering without being fooled by sparse counts.
History
The BYM model grew out of Julian Besag's work on Markov random fields and Bayesian image analysis. The 1991 Annals of the Institute of Statistical Mathematics paper by Besag, York, and Mollie, 'Bayesian image restoration, with two applications in spatial statistics,' applied this machinery to disease mapping, proposing the convolution of an intrinsic CAR spatial effect and an independent heterogeneity effect for small-area counts. The model became widely used in spatial epidemiology, and MCMC software (WinBUGS) and later integrated nested Laplace approximation (INLA) made it practical to fit routinely. Identifiability and prior-scaling problems with the original formulation were addressed by Riebler, Sorbye, Simpson, and Rue (2016), whose BYM2 reparameterization scales the spatial effect and introduces an interpretable mixing parameter with penalized-complexity priors.
When to use it
Use the BYM model when you have counts of a disease or event aggregated to small areas, want to estimate and map the underlying relative risk, and need to stabilize noisy rates by borrowing strength across space. It is a natural choice when areas have a meaningful adjacency structure, when raw small-area rates are unstable because counts are sparse, and when you want to separate spatially structured variation (which may point to location-linked exposures) from unstructured heterogeneity. Prefer the BYM2 reparameterization when you need to interpret how much variation is spatial, want priors that transfer across maps with different graphs, or face identifiability concerns. Do not use it when the scientific aim is to test for discrete clusters with a p-value (a scan statistic is designed for that), when areas have no sensible neighborhood graph, or when the count process is far from Poisson in ways the random effects cannot absorb. It assumes the chosen adjacency structure reasonably reflects spatial dependence.
Limitations and considerations
- In its original form the two variance components are weakly identified and not on comparable scales, complicating interpretation and prior choice.
- Results depend on the adjacency definition, and the binary first-order neighbor graph is a crude model of true spatial dependence.
- Smoothing can oversmooth genuine sharp boundaries or attenuate true localized excesses (ecological smoothing bias).
- Fitting requires Bayesian computation (MCMC or INLA) and care with the improper ICAR prior, constraints, and convergence.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Stabilizes unreliable small-area rates by borrowing strength from neighbors, yielding smoother, more trustworthy risk maps.
- Separates spatially structured variation from unstructured heterogeneity, aiding interpretation of whether risk is location-linked.
- Sits in a flexible hierarchical Bayesian framework that propagates uncertainty and accommodates covariates and extensions (space-time, multivariate).
- The BYM2 reparameterization gives interpretable, near-orthogonal hyperparameters with priors that transfer across different maps.
Applications
- Mapping small-area relative risk of cancers, cardiovascular disease, and other chronic conditions from registry counts.
- Smoothing infant-mortality, low-birth-weight, or other small-number health indicators across districts.
- Estimating the share of geographic variation in a health outcome that is spatially structured versus idiosyncratic.
- Serving as the spatial backbone for space-time and multivariate disease-mapping models and ecological regressions.
- Producing stabilized small-area estimates to guide public-health resource allocation and surveillance.
How it works
How it works
The model starts from a Poisson likelihood for the observed count in each area, with mean equal to the expected count (from indirect standardization on age and sex) times the area's relative risk. Modeling the log relative risk as an intercept plus random effects places the whole problem in a generalized linear mixed framework: the intercept sets the overall risk level and the random effects capture departures from it. Using expected counts as an offset is what turns raw counts into relative risks comparable across areas of different size and demographic composition, and the log link keeps relative risks positive and additive on the log scale.
Formula
y_i \sim \text{Poisson}(E_i\,\theta_i),\qquad \log\theta_i = \alpha + u_i + v_iThe spatially structured random effect is given an intrinsic conditional autoregressive (ICAR) prior, in which each area's effect, conditional on the others, is normally distributed around the mean of its neighbors with variance inversely proportional to the number of neighbors. This encodes the assumption that nearby areas have similar risk and is the mechanism by which the model borrows strength across space, smoothing each estimate toward its local neighborhood. The neighborhood structure is supplied as an adjacency graph, and because the ICAR prior is improper (defined only up to a constant), it is identified through the sum-to-zero constraint and the presence of the intercept.
Formula
u_i \mid u_{-i} \sim \mathcal{N}\!\left(\frac{1}{n_i}\sum_{j\sim i} u_j,\ \frac{\sigma_u^2}{n_i}\right),\quad j\sim i \Leftrightarrow \text{areas } i,j \text{ adjacent}Alongside the structured effect, each area gets an independent, identically distributed normal random effect that captures heterogeneity with no spatial pattern, such as area-specific data quality, unmeasured local factors, or pure overdispersion beyond Poisson variation. This unstructured component prevents the model from forcing every deviation to be spatially smooth, so a single anomalous area is not smeared across its neighbors. Including both effects is the defining feature of BYM: the data, through the relative sizes of the two variance components, determine how much of the variation is spatially structured versus idiosyncratic.
Formula
v_i \stackrel{iid}{\sim} \mathcal{N}(0,\ \sigma_v^2),\qquad \text{(spatially unstructured heterogeneity)}The two random effects enter the log relative risk additively, so each area's total random effect is the convolution of a structured and an unstructured term. Marginally, the total variance is approximately the sum of the two component variances; this is only an approximation, because the ICAR conditional variance depends on each area's number of neighbors. The convolution is flexible, spanning purely spatial smoothing to purely independent heterogeneity, but the two variance parameters are only weakly identified, since at each area the data mainly inform their combined effect, and their scales are not directly comparable. This makes prior choice and interpretation awkward and motivates the reparameterization in the next step.
Formula
b_i = u_i + v_i,\qquad \text{Var}(b_i) \approx \sigma_u^2 + \sigma_v^2\ \ (\text{convolution})The BYM2 reparameterization of Riebler and colleagues rewrites the convolution as a single random effect scaled by a total standard deviation and split between a scaled ICAR component and an unstructured component through a mixing proportion between zero and one. Crucially, the spatial component is scaled so that its variance interpretation is the same across different adjacency graphs, making priors transferable between studies, and the mixing parameter directly measures the fraction of variance that is spatially structured. This gives near-orthogonal, interpretable hyperparameters on which sensible penalized-complexity priors can be placed, fixing the identifiability and prior-specification problems of the original BYM while preserving its modeling intent.
Formula
b = \frac{1}{\sqrt{\tau_b}}\bigl(\sqrt{1-\phi}\,v_{\star} + \sqrt{\phi}\,u_{\star}\bigr),\quad \phi\in[0,1],\ u_{\star}\ \text{scaled ICAR}Common pitfalls
- Placing independent, equally scaled priors on the two variances in the original BYM, ignoring that only their sum is well identified.
- Failing to scale the ICAR component (as BYM2 does), so the same prior means different things on different maps.
- Mis-specifying the adjacency graph (e.g., islands with no neighbors, or wrong contiguity), which distorts the structured effect.
- Reading the smoothed map as if it had no uncertainty, instead of reporting posterior intervals or exceedance probabilities.
Frequently asked questions
Why does the BYM model need both a structured and an unstructured random effect?
Because geographic variation in disease risk has two distinct flavors. Some of it is spatially smooth, where nearby areas resemble each other because they share location-linked exposures, and the structured ICAR effect captures this by shrinking each area toward its neighbors. Some of it is idiosyncratic, where a single area deviates for reasons unrelated to location, such as data artifacts or purely local factors, and the unstructured effect captures this independent heterogeneity. With only the structured effect, the model would force every anomaly to spread across neighbors; with only the unstructured effect, it would ignore real spatial smoothing. Including both lets the data decide, through the two variance components, how much of the variation is spatial.
What problem does the BYM2 reparameterization solve?
The original BYM model has two variance parameters that are only weakly identified, because at each area the data mainly inform the sum of the two random effects, not each separately, and the two are measured on incomparable scales that depend on the adjacency graph. This makes it hard to choose priors or to interpret how much variation is spatial. Riebler and colleagues' BYM2 rewrites the model with a single total-variance parameter and one mixing parameter between zero and one giving the spatial fraction, and it scales the ICAR component so the prior means the same thing on any map. The hyperparameters become near-orthogonal and interpretable, and penalized-complexity priors can be placed on them sensibly.
How is the BYM model usually fitted in practice?
Historically it was fitted by MCMC in WinBUGS or OpenBUGS, but the modern standard is integrated nested Laplace approximation via the R-INLA package, which fits the BYM and BYM2 models quickly and accurately for latent Gaussian models like this one. Stan (and brms) and Nimble are also used, particularly for custom extensions. In all cases the analyst supplies the observed and expected counts and an adjacency graph, specifies the ICAR plus heterogeneity (or BYM2) structure, places priors on the hyperparameters (penalized-complexity priors are recommended for BYM2), and then summarizes the posterior relative risks with maps, credible intervals, and exceedance probabilities rather than point estimates alone.
Related methods
Sources
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 referenceRiebler, A., Sorbye, S. H., Simpson, D., & Rue, H. (2016). An intuitive Bayesian spatial model for disease mapping that accounts for scaling. Statistical Methods in Medical Research, 25(4), 1145-1165.
Open DOI reference