Gaussian Markov Random Field (MRF) and conditional autoregressive models are essentially the same thing, apart from details of specification.
adjacency
and AR1
random effects can be seen as specific MRFs.
The common idea is the Markov-like property that the distribution of each element \(b_i\) of the random-effect b, given values of a few specific elements (the “neighbours” of \(i\)), is independent of other elements (i.e., of non-neighbours). The non-zero non-diagonal elements of a precision matrix characterize the neighbours.
Given the inferred vector b of values of the MRF on the lattice, the interpolation of the MRF in any focal point is of the form Ab where each row of A weights the values of b according to the position of the focal point relative to the vertices of the lattice. Following the original publications, for regular grids (NULL model
), the weights are computed as <Wendland function>(<scaled Euclidean distances beween focal point and vertices>); and for grids given by model=<inla.spde2 object>
, the non-zero weights are the barycentric coordinates of the focal point in the enclosing triangle from the mesh triangulation (points from outside the mesh would have zero weights, so the predicted effect Ab=0).
The IMRF
model defines both a lattice in space, the precision matrix for a Gaussian MRF over this lattice, and the A weights. The full specification of the MRF on irregular lattices is complex. The \(\kappa\) parameter considered by spaMM
is the \(\kappa\) considered by Lindgren et al.; only the case d=2 and \(alpha=\) 1 or 2, approximating a Mat<U+00E9>rn correlation model with \(nu=0\) or \(nu=1\) (\(alpha=nu + d/2\)), is currently implemented in spaMM
.
For the MRFs on regular grids implemented here, the precision matrix is defined (up to a variance parameter) as M'M where the diagonal elements \(m_{ii}\) of M are 4+\(\kappa^2\) and the \(m_{ij}\) for the four nearest neighbours are -1 (note that M'M involves more than these four neighbours).
The precision matrix defined in this way is the inverse of an heteroscedastic covariance matrix C, but by default a normalization is applied so that the random effect is homoscedastic. As for other random effects, the variance is further controlled by a multiplicative factor \(\lambda\). The ormalization is as follows: the design matrix of the random effect term is viewed as WAL where W is a diagonal normalization matrix, A is the above-described weight matrix, and L is a “square root” of C. If no normalization is applied, the covariance matrix of the random effect is of the form \(\lambda\)ALL'A', which is heteroscedastic; \(\lambda\) may then be quite different from the marginal variance of the random effect, and is difficult to describe in a simple way. Hence, by default, W is defined such that WALL'A'W' has unit diagonal; then, \(\lambda\) is the marginal variance of the random effect.
By default, the IMRF lattice is rectangular (currently the only option) and is made of a core lattice, to which margins of margin
steps are added on each side. The core lattice is defined as follows: in each of the two spatial dimensions, the range of axial coordinates is determined. The largest range is divided in nd-1
steps, determining nd
values and step length \(L\). The other range is divided in steps of the same length \(L\). If it extends over (say) \(2.5 L\), a grid of 2 steps and 3 values is defined, and by default centered on the range (the extreme points therefore typically extend slightly beyond the grid, within the first of the additional steps defined by the margin
; if not centered, the grid start from the lower coordinate of the range).
multIMRF
implements multilevel IMRFs. It defines a sequence of IMRFs, with progressively finer lattices, a common \(\kappa\) value hy_kap
for these IMRFs, and a single variance parameter hy_lam
that determines \(\lambda\) values decreasing by a factor of 4 for successive IMRF terms. By default, each component IMRF
is normalized independently as described above (as in Nychka et al. 2019), and hy_lam
is the sum of the variances of these terms (e.g., if there are three levels and hy_lam=1
, the successive variances are (1,1/4,1/16)/(21/16) ). The nd
of the first IMRF is set to the coarse
value, and its lattice is defined accordingly. If coarse=4
and margin=5
, a grid of 14 coordinates is therefore defined over the largest range. In the second IMRF, the grid spacing is halved, so that new steps are defined halfway between the previous ones (yielding a grid of 27 stepin the widest range). The third IMRF proceeds from the second in the same way, and so on.
To control initial or fixed values of multIMRF
\(\kappa\) and variance parameters, the hyper
syntax shown in the Examples should be used. hyper
possible elements are named "1"
, "2"
, ... referring to successive multIMRF
terms in the formula.