Modelling areal data
Areal data are data which come from well-defined geographical units such as postcode areas, health boards, or pixels on a satellite image.
As with other types of spatial modelling, our goal is to observe and explain spatial variation in our data.
We are trying to understand and account for spatial dependence.
Generally, we aim to produce a smoothed map that summarises the spatial patterns observed in our data.
An areal process (or lattice process) is a stochastic process defined on a set of regions that form a partition of our region of interest \(D\).
Let \(B_1, \ldots B_m\) be our set of \(m\) distinct regions such that: \[\bigcup\limits_{i=1}^m \hspace{1mm}B_i = D.\]
Here we require that our regions are non-overlapping, with \[B_i \cap B_j = \emptyset.\]
Then our areal process is simply the stochastic process \[\{Z(B_i); i=1,\ldots,m\}.\]
Each of our regions \(B_i\) has a set of other regions nearby which can be considered neighbours
We might expect that areas have more in common with their neighbours than with regions further away.
Therefore, we can construct dependence structures based on the principle that neighbours are correlated and non-neighbours are uncorrelated.
First, we need to come up with a sensible way of defining what a neighbour is in this context.
There are many different ways to define a region’s neighbours.
The most common ones fall into two main categories - those based on borders, and those based on distance.
Common borders
Assume that regions which share a border on a map are neighbours.
Simple and easy to implement
Treats all borders the same, regardless of length, which can be unrealistic.
Areas very close together are not neighbours if there is even a small gap between them.
Distance-based
Assume that regions which are a within a certain distance of each other area neighbours.
What distance do you choose? How do you decide that?
Where do you measure from? (e.g., nearest border or a central point).
Once we have identified a set of neighbours we construct a neighbourhood matrix (or proximity matrix), which defines how each of our \(m\) regions relate to each other.
Let \(W\) denote an \(m \times m\) matrix where the \((i,j)\)th entry, \(w_{ij}\) denotes the proximity between regions \(B_i\) and \(B_j\).
Note
The values of this matrix can be discrete (which regions are neighbours) or continuous (how far apart are the regions).
The spdep package in R can be used on an sf spatial polygon object to define \(W\) using the poly2nb() and nb2mat() functions.
The by far most common approach is to use a binary neighbourhood matrix, \(W\), denoted by
\[ \begin{aligned} w_{ij} &= 1 \hspace{2mm} \mbox{ if areas} (B_i, B_j) \mbox{ are neighbours.}\\ w_{ij} &= 0 \hspace{2mm} \mbox{ otherwise.} \end{aligned} \]
Dependence structures are described through this spatial weights matrix
Binary matrices are used for simplicity
Imagine we have animal counts in each region. We can model them as Poisson counts
\[ y_i \sim \mathrm{Poisson}(e^{\eta_i}) \] How do we model the linear predictor \(\eta_i\)?
\[ \eta_i = \beta_0 + \mathbf{x}'\beta + u_i ~~~ u_i \overset{iid}{\sim} N(0,\sigma^2_i) \]
Imagine we have animal counts in each region. We can model them as Poisson counts
\[ y_i \sim \mathrm{Poisson}(e^{\eta_i}) \] How do we model the linear predictor \(\eta_i\)?
Imagine we have animal counts in each region. We can model them as Poisson counts.
\[ y_i \sim \mathrm{Poisson}(e^{\eta_i}) \] How do we model the linear predictor \(\eta_i\)?
\[ \eta_i = \beta_0 + \mathbf{x}'\beta + u_i ~~~ u_i \overset{iid}{\sim} N(0,\Sigma) \]
\[ \mathcal{u}\sim\mathcal{N}(0,\Sigma) \]
Force the covariance matrix \(\Sigma\) to be sparse
Force the precision matrix \(\Sigma^{-1}\) to be sparse
\[ \mathcal{u}\sim\mathcal{N}(0,\Sigma) \]
Force the covariance matrix \(\Sigma\) to be sparse
Force the precision matrix \(\mathbf{Q} = \Sigma^{-1}\) to be sparse
\[ \mathcal{u}\sim\mathcal{N}(0,\Sigma) \]
Force the covariance matrix \(\Sigma\) to be sparse
Force the precision matrix \(\mathbf{Q} = \Sigma^{-1}\) to be sparse
Definition
\[ \begin{aligned} \mathbf{i=1}&: x_1 \sim N\left(0, \frac{1}{1-\phi^2}\right)\\ \mathbf{i=2,\dots,T}&: x_i = \phi\ x_{i-1} +\epsilon_i,\ \epsilon_i\sim\mathcal{N}(0,1) \end{aligned} \]
Covariance Matrix
\[ \Sigma = \frac{1}{1-\phi^2} \begin{bmatrix} 1& \phi & \phi^2 & \dots& \phi^N \\ \phi & 1& \phi & \dots& \phi^{N-1} \\ \phi^2 & \phi & 1 & \dots& \phi^{N-2} \\ \dots& \dots& \dots& \dots& \dots& \\ \phi^{N} & \phi^{N-1}& \phi^{N-2} & \dots& 1\\ \end{bmatrix} \]
This is a dense matrix.
All elements of the \(\mathbf{x}\) vector are dependent.
Precision Matrix
\[ \mathbf{Q} = \Sigma^{-1} = \begin{bmatrix} 1& -\phi & 0 & 0 &\dots& 0 \\ -\phi & 1 + \phi^2& -\phi & 0 & \dots& 0 \\ 0 & -\phi & 1-\phi^2 &-\phi & \dots& 0 \\ 0 & 0 & -\phi &1-\phi^2 & \dots & \dots \\ \dots& \dots& \dots& \dots& \dots& \dots& \\ 0 &0 & 0 & \dots & -\phi& 1\\ \end{bmatrix} \]
This is a tridiagonal matrix, it is sparse.
The tridiagonal form of \(\mathbf{Q}\) can be exploited for quick calculations.
What is the key property of this example that causes \(\mathbf{Q}\) to be sparse?
The key lies in the full conditionals
\[ x_t|\mathbf{x}_{-t}\sim\mathcal{N}\left(\frac{\phi}{1-\phi^2}(x_{t-1}+x_{t+1}), \frac{1}{1+\phi^2}\right) \]
The circles represent the values of \(x\) at individual time points
There is a line between them if they are conditionally dependent
Each point in time is only conditionally dependent on the two closest neighbours
The nonzero pattern in the precision matrix is given by the neighborhood structure of the process
Markov in Space:
First order conditional autoregressive model or a CAR(1) model.
Models based on neighbourhood have a name in statistics: they are Markovian models
Markovian models are specified entirely through “neighbourhood structures”
Recall our first Model:
\[ \begin{aligned} y_i &\sim \mathrm{Poisson}(e^{\eta_i}) \\ \eta_i &= \beta_0 + \mathbf{x}'\beta + u_i ~~~ u_i \sim N(0,Q^{-1}) \end{aligned} \]
This mean \(u_i\) is independent of all the other parameters \(\mathbf{u}_{-i}\), given the set of its neighbors.
for any pair of elements (\(i,j\)) in \(\mathbf{u}\), \(u_i\perp u_j|\mathbf{u}_{-ij}\Longleftrightarrow Q{ij} =0\)
\(Q{ij} \neq 0\) only if \(j\in \{i,\mathcal{N}(i)\}\)
Gauss Markov random field (GMRF) is
GMRFs are key to the many inferential approaches:
An example of a GMRF is the Besag model a.k.a. the Intrinsic Conditional Autoregressive (ICAR) model. The conditional distribution for \(u_i\) is
\[ u_i|\mathbf{u}_{-i},\tau_u, \sim N\left(\frac{1}{d_i}\sum_{j\sim i}u_j,\frac{1}{d_i\tau_u}\right) \]
\(\mathbf{u}_{-i} = (u_i,\ldots,u_{i-1},u_{i+1},\ldots,u_n)^T\)
\(\tau_u\) is the precision parameter (inverse variance).
\(d_i\) is the number of neighbours
The mean of \(u_i\) is equivalent to the mean of the effects over all neighbours, and the precision is proportional to the number of neighbours (e.g., if an area has many neighbours then its variance will be smaller)
The joint distribution is given by:
\[ \mathbf{u}|\tau_u \sim N\left(0,\frac{1}{\tau_u}Q^{-1}\right), \]
where \(Q\) denotes the precision matrix defined as
\[ Q_{i,j} = \begin{cases} d_i, & i = j \\ -1, & i \sim j \\ 0, &\text{otherwise} \end{cases} \]
This structure matrix directly defines the neighbourhood structure and is sparse.
Larynx cancer relative risk map
Connecting all the neighbouring areas yields the following graph
We apply an ICAR model where each region conditionally has a Gaussian distribution with mean equal to the average of the neighbours and a precision proportional to the number of neighbour
\[ x_9\mid\mathbf{x}_{-9}\sim N\left(\frac{1}{6}(x_7+x_{11}+x_{12}+x_{13}+x_{14}+x_{15}),\frac{1}{6\tau}\right) \]
The sub graph leads to a precision matrix with 21.6% non-zero elements.
The full graph leads to a precision matrix with 0.1% non-zero elements.
The ICAR model accounts only for spatially structured variability and does not include a limiting case where no spatial structure is present.
We typically add an unstructured random effect \(z_i|\tau_z \sim N(0,\tau_{z}^{-1})\) to account for region-specific differences.
The resulting model \(v_i = u_i + z_i\) is known as the Besag-York-Mollié model (BYM)
The structured spatial effect is controlled by \(\tau_u\) which controls the degree of smoothing:
Higher \(\tau_u\) values lead to stronger smoothing (less spatial variability).
Lower \(\tau_u\) values allow for greater local variation.
In the following example we will illustrate how to fit this model using inlabru.
In this example we model the number of respiratory hospitalisations across Intermediate Zones (IZ) that make up the Greater Glasgow and Clyde health board in Scotland.
In epidemiology, disease risk is assessed using Standardized Mortality Ratios (SMR):
\[ SMR_i = \dfrac{Y_i}{E_i} \]
Recall that a LGM consists of three elements:
- Stage 1: We assume the responses are Poisson distributed: \[ \begin{aligned}y_i|\eta_i & \sim \text{Poisson}(E_i\lambda_i)\\\text{log}(\lambda_i) = \color{#FF6B6B}{\boxed{\eta_i}} & = \color{#FF6B6B}{\boxed{\beta_0 + \beta_1 \mathrm{pm10} + u_i + z_i} }\end{aligned} \]
- Stage 2: \(\eta_i\) is a linear function of four components: an intercept, pm10 effect , a spatially structured effect \(u\) and an unstructured iid random effect \(z\):
\[ \eta_i = \beta_0 + \beta_1 \mathrm{pm10} + u_i + z_i \]
- Stage 3: \(\{\tau_{z},\tau_u\}\): Precision parameters for the random effects
The latent field is \(\mathbf{u}= (\beta_0, \beta_1, u_1, u_2,\ldots, u_n,z_1,...)\), the hyperparameters are \(\boldsymbol{\theta} = (\tau_u,\tau_z)\), and must be given a prior.
The Model
\[ \begin{aligned} y_i|\eta_t & \sim \text{Poisson}(E_i\lambda_i)\\ \text{log}(\lambda_i) = \eta_i & = \color{#FF6B6B}{\boxed{\beta_0}} + \color{#FF6B6B}{\boxed{\beta_1 \mathrm{pm10}}} + \color{#FF6B6B}{\boxed{u_i}} + \color{#FF6B6B}{\boxed{z_i}} \end{aligned} \]
The code
# define model component
cmp = ~ Intercept(1) + pm10(pm10, model = "linear") +
ui(region_id, model = "besag", graph = Q) +
zi(region_id, model = "iid")
# define model predictor
eta = observed ~ Intercept + ui + vi + pm10
# build the observation model
lik = bru_obs(formula = eta,
family = "poisson",
E = expected,
data = resp_cases)
# fit the model
fit = bru(cmp, lik)The Model
\[ \begin{aligned} y_i|\eta_t & \sim \text{Poisson}(E_i\lambda_i)\\ \text{log}(\lambda_i) = \color{#FF6B6B}{\boxed{\eta_i}} & = \color{#FF6B6B}{\boxed{\beta_0 + \beta_1 \mathrm{pm10} + u_i + z_i}} \end{aligned} \]
The code
# define model component
cmp = ~ Intercept(1) + pm10(pm10, model = "linear")
ui(region_id, model = "besag", graph = Q) +
vi(region_id, model = "iid")
# define model predictor
eta = observed ~ Intercept + ui + vi + pm10
# build the observation model
lik = bru_obs(formula = eta,
family = "poisson",
E = expected,
data = resp_cases)
# fit the model
fit = bru(cmp, lik)The Model
\[ \begin{aligned} \color{#FF6B6B}{\boxed{y_i|\eta_t}} & \sim \color{#FF6B6B}{\boxed{\text{Poisson}(E_i\lambda_i)}}\\ \text{log}(\lambda_i) = \eta_i & = \beta_0 + \beta_1 \mathrm{pm10} + u_i + z_i \end{aligned} \]
The code
# define model component
cmp = ~ Intercept(1) + pm10(pm10, model = "linear")
ui(region_id, model = "besag", graph = Q) +
vi(region_id, model = "iid")
# define model predictor
eta = observed ~ Intercept + ui + vi + pm10
# build the observation model
lik = bru_obs(formula = eta,
family = "poisson",
E = expected,
data = resp_cases)
# fit the model
fit = bru(cmp, lik)The Model
\[ \begin{aligned} y_i|\eta_t & \sim \text{Poisson}(E_i\lambda_i)\\ \text{log}(\lambda_i) = \eta_i & = \beta_0 + \beta_1 \mathrm{pm10} + u_i + z_i \end{aligned} \]
The code
# define model component
cmp = ~ Intercept(1) + pm10(pm10, model = "linear")
ui(region_id, model = "besag", graph = Q) +
vi(region_id, model = "iid")
# define model predictor
eta = observed ~ Intercept + ui + vi + pm10
# build the observation model
lik = bru_obs(formula = eta,
family = "poisson",
E = expected,
data = resp_cases)
# fit the model
fit = bru(cmp, lik)Posterior summaries
| mean | 0.025quant | 0.975quant | |
|---|---|---|---|
| Intercept | −1.52 | −1.91 | −1.12 |
| pm10 | 0.09 | 0.07 | 0.12 |
| Precision for ui | 2.82 | 2.28 | 3.45 |
| Precision for vi | 21,828.33 | 1,415.98 | 85,763.09 |
In the original BYM, the spatially structured component must be scaled so that \(\tau_u\) produces consistent smoothness across different neighborhood structures.
Riebler et al. (2016) proposed a new parametrization of the BYM model based on PC-priors that improves parameter interpretability.
\[ \mathbf{b} = \dfrac{1}{\sqrt{\tau_b}} \left(\sqrt{1-\phi}v^*+\sqrt{\phi}u^*\right). \]
The precision \(\tau_b>0\) controls the marginal variance contribution of the weighted sum \(u^*\) and \(v^*\).
The mixing parameter \(0 \leq \phi \leq 1\) measures the proportion of the marginal variance explained by the structured effect \(u^*\)
if \(\phi =1\) the model captures only spatially structured variability
if \(\phi = 0\) it accounts solely for unstructured spatial noise.
The BYM2 model allows the specification of Penalized Complexity (PC) priors to control the amount of spatial smoothing and to avoid overfitting.
\[ \begin{aligned} P(1/\sqrt{\tau_b} > U) &= \alpha\\ P(\phi < U) &= \alpha \end{aligned} \]
\[ \begin{aligned} P((1/\sqrt{\tau_b}) > 0.5/0.31) &\equiv P(\sigma > 1.61) = 0.01\\ P(\phi < 0.5) &= 2/3 \approx 0.66 \end{aligned} \]
Interpretation:
Prior on \(\tau_b\): low probability of large values
Prior on \(\phi\) assumes that the unstructured random effect accounts for more of the variability than the spatially structured effect.
The BYM2 model allows the specification of Penalized Complexity (PC) priors to control the amount of spatial smoothing and avoid overfitting.
Interpretation:
Prior on \(\tau_b\): low probability of large values
Prior on \(\phi\): assumes that the unstructured random effect accounts for more of the variability than the spatially structured effect.
Goicoa et al. (2018) Lee et al. (2022) Orozco-Acosta et al. (2021) Riebler et al. (2016) Seaton et al. (2024) Simpson et al. (2017) vicente2020bayesian