Riebler 2016 - Scaling and the BYM2 Construction
Summary
The marginal variances of an intrinsic GMRF depend on the graph, so a fixed prior on gives different smoothing on different maps. Scale so the geometric mean of the marginal variances (the generalised variance ) is 1; then BYM2 has marginal variance about and is the spatial fraction.
Overview
Graph-dependence example (Fig. 1): with , for Mittelfranken (12 districts), for Arnsberg (12 districts), for all 544 German districts, for the 3,111 continental US counties. Equal does not mean equal scale.
Main Content
Generalised variance and scaling (eq. 6)
Scaled structure matrix so that the geometric mean of equals 1.
Computation: avoid dense generalised inverse; for null space (e.g. ) add small to the diagonal and use the conditional-on-constraints marginal variances with sparse algebra (Rue & Held 2005, Sec. 3.2). INLA: inla.scale.model(Q, constr=list(A=matrix(1,1,n), e=0)). Scaling also matters for hypothesis testing on IGMRFs. The Leroux model cannot be scaled because the scale depends on .
BYM2 model (eq. 7-8)
is the proportion of marginal variance explained by the structured effect; pure overdispersion, Besag. Marginal variances are approximately (approximate because equalises variances only in geometric mean).
Sparsity-preserving augmented parameterisation (Sec. 3.4)
The covariance in (8) contains , so its inverse is dense. Let with , : . Then has precision
sparse; has the correct marginal and is the structured component.
Examples
Scaling factor on a 4x4 grid
Compute the geometric-mean marginal variance of the Besag model on a 16-node grid graph and rescale: ; after scaling the geometric mean is 1 (verified).
import numpy as np
k = 4; n = k*k; A = np.zeros((n, n))
for i in range(k):
for j in range(k):
a = i*k + j
if i+1 < k: A[a, a+k] = A[a+k, a] = 1
if j+1 < k: A[a, a+1] = A[a+1, a] = 1
Q = np.diag(A.sum(1)) - A # Besag precision (connected graph, null space = 1)
c = np.exp(np.mean(np.log(np.diag(np.linalg.pinv(Q))))) # sigma^2_GV for tau=1
Qs = Q * c # scaled
print(c, np.exp(np.mean(np.log(np.diag(np.linalg.pinv(Qs)))))) # ~0.4716, 1.0PyMC 5 BYM2 sketch (E18; untested; pm.ICAR requires the graph and a sum-to-zero soft constraint):
import pymc as pm
with pm.Model():
mu = pm.Normal("mu", 0, 1)
tau_sd = pm.Exponential("sigma", 1/0.31) # PC prior on sd: P(sigma > U)=alpha -> rate = -log(alpha)/U
phi = pm.Beta("phi", 0.5, 0.5) # placeholder; PC prior for phi is tabulated (see PC note)
v = pm.Normal("v", 0, 1, shape=n)
u = pm.ICAR("u", W=A, sigma=1.0, zero_sum_stdev=0.001) / np.sqrt(c) # scale: Q* = c Q -> sd(u*) = sd(u)/sqrt(c)
b = tau_sd * (pm.math.sqrt(1 - phi) * v + pm.math.sqrt(phi) * u)
pm.Poisson("y", mu=E * pm.math.exp(mu + b), observed=y)Check: with and from the code above, , so a unit-scale ICAR draw is divided by , as in the sketch.
Marketing note: with geo-level lift estimates on an adjacency graph, BYM2 yields a single interpretable (“how much of between-DMA heterogeneity is geographic”) portable across country maps.
Connections
Riebler 2016 - Penalised Complexity Priors for BYM2 puts priors on ; Spatial Models - BYM explains the unscaled baseline.