Departement of Mathematics
Markov Random Fields
An extension from a temporal to a spatial setting
Cornelia Richter
STA381: Stochastic Simulation Seminar
03 June 2021 Departement of Mathematics
Outline I
1. Spatial Models for Lattice Data 2. Conditionally Autoregressive Models 3. Graphs and Gaussian Markov Random Fields 4. Random Walk Models: Intrinsic Gaussian Markov Random Fields 5. Extension: A way of predicting in statistical models for random fields 6. Summary 7. Outlook
03 June 2021 Markov Random Fields Page 2 Departement of Mathematics
Motivation
– very important branch of probability theory – promising results in both theory and application
03 June 2021 Markov Random Fields Page 3 Departement of Mathematics
Spatial Models for Lattice Data I
– so far: Markov property based on time (continuous and discrete) – now: Markov property based on space (naturally continuous) → typically called lattice or areal data
03 June 2021 Markov Random Fields Page 4 Departement of Mathematics
Spatial Models for Lattice Data II
Main difference between time series and lattice data: – time series: temporal direction forecasting (prediction) is very natural concept – lattice data: prediction very unusual, → focus on smoothing (filtering) → used to separate signal from noise or to fill in missing values
03 June 2021 Markov Random Fields Page 5 Departement of Mathematics
Spatial Models for Lattice Data: Example
– Partition of lower 48 US states into counties → set of representative location of the block defines a lattice → specific lattice has a varying density because of different county sizes
03 June 2021 Markov Random Fields Page 6 Departement of Mathematics
Example Lattice Data US Counties I
Figure: 48 lower US States
03 June 2021 Markov Random Fields Page 7 Departement of Mathematics
Example Lattice Data US Counties II
Figure: 3082 US Counties
03 June 2021 Markov Random Fields Page 8 Departement of Mathematics
Example Lattice Data US Counties III
Figure: Histogram of number of neighbors
03 June 2021 Markov Random Fields Page 9 Departement of Mathematics
Conditionally Autoregressive Models I
– basic idea: construct densities based on neighbors
– random vector Y, density fY (y) → f (yi | yj , i 6= j), i = 1,... n – approach: specify the joint density through n full conditional densities
f (yi | y−i ) – assume Gaussian full conditionals, likely to get a valid joint density
03 June 2021 Markov Random Fields Page 10 Departement of Mathematics
Conditionally Autoregressive Models II simple model for location i, given by
P 2 Yi | yj , j 6= i ∼ N( i,j6=i bij yj , τi ), i = 1, ..., n
→ with Brooks Lemma we conclude
−1 Y ∼ Nn(0, (I − B) T), 2 B = bij , bii = 0, T = diag(τi )
03 June 2021 Markov Random Fields Page 11 Departement of Mathematics
Conditionally Autoregressive Models II Continued
– covariance matrix is symmetric bij bji → we require 2 = 2 τi τj – (I − B) has to be positive definite
03 June 2021 Markov Random Fields Page 12 Departement of Mathematics
Conditionally Autoregressive Models III Neighbors
– i and j are neighbors, denoted by i ∼ j – temporal neighbors: previous/next value – spatial neighbors: sharing a common edge or boundary on a Graph
03 June 2021 Markov Random Fields Page 13 Departement of Mathematics
Conditionally Autoregressive Models III Neighbors - Example I
Figure: Neighbours: left - 4 neighbors of s, right - 8 neighbors of s
03 June 2021 Markov Random Fields Page 14 Departement of Mathematics
Conditionally Autoregressive Models III Neighbors - Example II
Figure: Neighbours: middle - von Neumann neighborhood, right - Moore neighborhood
03 June 2021 Markov Random Fields Page 15 Departement of Mathematics
Sudden Infant Death Syndrome Dataset (SIDS)
– sudden, unexplained death of a less than one year old child – SIDS dataset has been analysed a lot in literature, e.g. in Cressie (1993) – dataset: → birth counts and SIDS cases → periods: 1974 - 1978 and 1979 - 1984 → two ethnicities → 100 counties of North Carolina (NC) – our analysis: neighbors, fitting an conditionally autoregressive model, Morans test, kriging
03 June 2021 Markov Random Fields Page 16 Departement of Mathematics
Application CAR: SIDS I
Figure: SIDS Data - Area 03 June 2021 Markov Random Fields Page 17 Departement of Mathematics
Application CAR: SIDS I
Figure: Neighbors: SIDS Data 03 June 2021 Markov Random Fields Page 18 Departement of Mathematics
Application CAR: SIDS II
Figure: SIDS Data - Rates
03 June 2021 Markov Random Fields Page 19 Departement of Mathematics
Application CAR: SIDS II
Figure: SIDS Data - Rates without outlier
03 June 2021 Markov Random Fields Page 20 Departement of Mathematics
Application CAR: SIDS III
Figure: SIDS Data - Summary CAR Fit
03 June 2021 Markov Random Fields Page 21 Departement of Mathematics
Application CAR: SIDS IV
Figure: SIDS Data - Summary CAR Fit
03 June 2021 Markov Random Fields Page 22 Departement of Mathematics
Application CAR: SIDS V
Figure: SIDS Data - Summary CAR Fit
03 June 2021 Markov Random Fields Page 23 Departement of Mathematics
Graphs and (Gaussian) Markov Random Fields Graphs I
– graph G = (V, E), V...nodes, E... edges – graphs can be directed or undirected
03 June 2021 Markov Random Fields Page 24 Departement of Mathematics
Graphs and (Gaussian) Markov Random Fields Graphs II
Figure: Graphs: left - undirected graph, right - directed graph
03 June 2021 Markov Random Fields Page 25 Departement of Mathematics
Graphs and (Gaussian) Markov Random Fields Definitions I
Definition: Precision The Precision of a random variable is the inverse of the variance. In case of random vectors the inverse of a covariance function is called precision matrix. Note: High precision (i.e. low variance) implies a lot of knowledge about the variable.
03 June 2021 Markov Random Fields Page 26 Departement of Mathematics
Graphs and (Gaussian) Markov Random Fields Definitions II
Definition: Markov Random Field (MRF)
Let X = (Xs, s ∈ S) be a set of discrete random variables taking values in set V. X is a Markov random field with respect to the neighborhood system (Ns, s ∈ S), if P(Xs = x | Xt , t 6= s) = P(Xs = x | Xt , t ∈ Ns), x ∈ V, s ∈ S
03 June 2021 Markov Random Fields Page 27 Departement of Mathematics
Graphs and (Gaussian) Markov Random Fields Connection
→ a random field is a MRF if it satisfies the Markov property → a MRF is a set of random variables having a Markov property described by an undirected graph → X ⊥ Y denotes X and Y are independent → X ⊥ Y | Z = z denotes conditional independence of X and Y
03 June 2021 Markov Random Fields Page 28 Departement of Mathematics
Graphs and Gaussian Markov Random Fields Definitions III
Definition: Gaussian Markov Random Field (GMRF) T A random vector Y = (Y1, ..., Yn) is a Gaussian Markov Random Field with respect to a labeled graph G = (V, E) with mean µ and a symmetric and positive definite precision matrix Q, if its density is given by −n/2 1/2 1 T f (y) = (2π) det(Q) exp(− 2 (y − µ) Q(y − µ)) Qij 6= 0 ⇔ i, j ∈ E∀i 6= j
03 June 2021 Markov Random Fields Page 29 Departement of Mathematics
Graphs and Gaussian Markov Random Fields Properties
Property Let Y be a GMRF with respect to G = (V, E), with mean µ and precision matrix Q, then
1. Yi ⊥ Yj | Y−ij = y−ij ⇔ Qij = 0 1 P 2. E[Y | Y− = y− ] = µ − Q (y − µ ) i i i i Qii j:j∼i ij j j 3. Prec(Yi | Y−i = y−i ) = Qii Qij 4. Cor(Yi Yj | Y−ij = y−ij ) = −√ , i 6= j Qii Qjj
03 June 2021 Markov Random Fields Page 30 Departement of Mathematics
Simulation of Markov Random Fields: Binary Simulation I
Figure: Binary Simulation: Threshold 0, high sequence 03 June 2021 Markov Random Fields Page 31 Departement of Mathematics
Simulation of Markov Random Fields: Binary Simulation I
Figure: Binary Simulation: Threshold 0, low sequence 03 June 2021 Markov Random Fields Page 32 Departement of Mathematics
Simulation of Markov Random Fields: Binary Simulation II
Figure: Binary Simulation: Threshold 1, high sequence
03 June 2021 Markov Random Fields Page 33 Departement of Mathematics
Simulation of Markov Random Fields: Binary Simulation II
Figure: Binary Simulation: Threshold 1, low sequence
03 June 2021 Markov Random Fields Page 34 Departement of Mathematics
Simulation of Markov Random Fields: Circular Embedding
Figure: Circular Embedding: high sequence 03 June 2021 Markov Random Fields Page 35 Departement of Mathematics
Simulation of Markov Random Fields: Circular Embedding
Figure: Circular Embedding: low sequence 03 June 2021 Markov Random Fields Page 36 Departement of Mathematics
Random Walk Models: Intrinsic Gaussian Markov Random Fields I
– improper densities not integrating to one often used as priors in Bayesian frameworks → resulting posterior may be appropriate – consider e.g. a regression setting −1 relax condition of constant µ, Yi+1 − Yi ∼ N(0, κ ), instead of Yi+1 − Yi ≡ 0 – NOW locations of n random variables are equispaced observations on the transection
03 June 2021 Markov Random Fields Page 37 Departement of Mathematics
Random Walk Models: Intrinsic Gaussian Markov Random Fields II
iid −1 ∆Yi = Yi+1 − Yi , i = 1,..., n − 1, ∆Yi ∼ N(0, κ ) n−1 n−1 n−1 2 κ P 2 2 1 T ⇒ f (∆y) ∝ κ exp(− 2 i=1 (∆yi )) = κ exp(− 2 y Qy)
03 June 2021 Markov Random Fields Page 38 Departement of Mathematics
Random Walk Models: Intrinsic Gaussian Markov Random Fields II cont. 1 −1 0 ··· 0 . . −1 2 −1 .. . . . . T Q = κ 0 ...... 0 = κD D, . . . .. −1 2 −1 0 ··· 0 −1 1
−1 1 0 ··· . . . D = 0 ...... ∈ R(n−1)xn . . . .. −1 1
03 June 2021 Markov Random Fields Page 39 Departement of Mathematics
Random Walk Models: Intrinsic Gaussian Markov Random Fields III
Comments: – f is an improper density, thus IGMRF of first order – also Random Walk model of first order RW1 – matrix Q has rank n-1, hence rank deficient
03 June 2021 Markov Random Fields Page 40 Departement of Mathematics
Random Walk Models: Intrinsic Gaussian Markov Random Fields Definitons
Definition – Q (nxn) symmetric, positive semi-definite matrix, rank n − k > 0 – Y is an improper GMRF (IGMRF) of rank n − k, parameters (µ, Q) with respect to a labeled graph G = (V, E), if its density is f ∗(y) = (2π)−(n−k)/2det∗(Q)1/2exp(−0.5 ∗ (y − µ)T Q(y − µ))
03 June 2021 Markov Random Fields Page 41 Departement of Mathematics
Random Walk Models: Intrinsic Gaussian Markov Random Fields Definitons cont.
Comments:
– Qij 6= 0 ⇔ i, j ∈ E∀i 6= j – det∗(Q) ... generalized determinant, i.e. product of all nonzero eigenvalues of Q – ⇒ (µ, Q) no longer represent mean and precision, they formally no longer exist – IGMRF of first order (or (n-1) order) is an improper GMRF of rank (n-1), where Q1 ≡ 0
03 June 2021 Markov Random Fields Page 42 Departement of Mathematics
Random Walk Models: Intrinsic Gaussian Markov Random Fields Predictions in a RW Model
Prediction in a random walk model (RW1): 1 Yi | Y−i = y−i ∼ N(0.5(yi+1 + yi−1), 2κ ) p Yi+p | Yi = yi , Yi−1 = yi−1, · · · ∼ N(yi , κ ) 0 ≤ i + p ≤ n ⇒ no shrinkage towards the mean similar to a RW1, define RW2: 2 ∆ Yi = ∆Yi+1 − ∆Yi = Yi+2 − 2Yi+1 + Yi , i = 1, ..., n − 2 2 iid −1 ∆ Yi ∼ N(0, κ )
03 June 2021 Markov Random Fields Page 43 Departement of Mathematics
Sampling from an IGMRF Simulation Setup I
– Two types of singularities in covariance matrix for GMRF and IGMRF → (constrained) GMRF: "variance collapse" → IGMRF: "variance inflation" – Illustration of concept in the following
03 June 2021 Markov Random Fields Page 44 Departement of Mathematics
Sampling from an IGMRF Simulation Setup I
– same seed for all simulations, s.t. "projections" become clear → covariance matrix of GMRF simulations result in rank deficient covariance matrix (one eigenvalue is zero) same for precision matrix.
03 June 2021 Markov Random Fields Page 45 Departement of Mathematics
Sampling from an IGMRF Simulation Setup III
– RW1, simulate from Q(γ) = Q + γ11T for small γ – in RW1 model, no "marginal" distributions specified ⇒ no information about individual means known which could spread over the entire real line – eigenvalues of Q(γ): 2 and 2(0.5 + γ) 1 – one eigenvalue of covariance matrix is dependent on γ ⇒ variance inflation as γ tends to 0
03 June 2021 Markov Random Fields Page 46 Departement of Mathematics
Sampling from an IGMRF Sampling
Figure: Constrained sampling
03 June 2021 Markov Random Fields Page 47 Departement of Mathematics
Sampling from an IGMRF Sampling
Figure: mimicked RW1, γ = 0.01 (blue), γ = 0.1 (green)
03 June 2021 Markov Random Fields Page 48 Departement of Mathematics
Statistical Models for observations of random fields
(i) How can we predict an observation at an unobserved
location s0? (ii) How can we estimate parameters in such a model?
03 June 2021 Markov Random Fields Page 49 Departement of Mathematics
Statistical Models for observations of random fields
– one answer to prediction problem is kriging → after South American mining engineer D.G. Krige
03 June 2021 Markov Random Fields Page 50 Departement of Mathematics
Kriging - preparation
– fit a simultaneous autoregressive model → alternative to CAR one introduced earlier – we have P 2 Yi = j,j6=i bij Yj + i , with i ∼ N(0, σi ), i = 1,..., n – variogram function measuring dissimilarities, describing behavior of a process, important to analyze spatial variability
03 June 2021 Markov Random Fields Page 51 Departement of Mathematics
Kriging Process
(1) remove some observations (arbitrarily)
Figure: Missing Observations: red crosses indicate removed observations
03 June 2021 Markov Random Fields Page 52 Departement of Mathematics
Kriging Process
(2) fit a SAR model (3) compute variogram (4) perform kriging (5) compute prediction error → -0.00047, -0.00063, 0.0011 → very low ⇒ GOOD! (6) further steps: e.g. cross validation
03 June 2021 Markov Random Fields Page 53 Departement of Mathematics
Moran’s test for autocorrelation
– multivariate random n-vector Y,
– W = (wij ) matrix of spatial weights → often describing a first order neighborhood structure – define Moran’s I as follows, P ¯ ¯ n i,j wij (Yi −Y )(Yj −Y ) I = P w ∗ P ¯ 2 ∈ [−1, 1] i,j ij i (Yi −Y )
03 June 2021 Markov Random Fields Page 54 Departement of Mathematics
Moran’s test for autocorrelation
Figure: R Output - Moran’s I
03 June 2021 Markov Random Fields Page 55 Departement of Mathematics
Moran’s test for autocorrelation
– → positive autocorrelation observed!
03 June 2021 Markov Random Fields Page 56 Departement of Mathematics
Moran’s test for autocorrelation
Figure: Moran Plot for autocorrelation 03 June 2021 Markov Random Fields Page 57
→ SIDS rates (x-axis) against spatially lagged values (y-axis) → showing influence measures for linear relationship between data and lag → Observations influencing this are highlighted with a diamond shape Departement of Mathematics
Summary
– Extension of Markov Property from temporal to spatial setting – Lattice Data: SIDS dataset – CAR models – Introduction to (intrinsic) Gaussian Markov Random Fields and how to simulate them – Random Walk Models on IGMRF – Outlook on Spatial Statistics: Kriging
03 June 2021 Markov Random Fields Page 58 Departement of Mathematics
Outlook
– many more extensions possible – non Gaussian MRF: Ising Model – extend Spatial Statistics Setting
03 June 2021 Markov Random Fields Page 59 Departement of Mathematics
Thanks for your attention! Questions?
03 June 2021 Markov Random Fields Page 60 Departement of Mathematics
Backup Slides Specific Models for GMRFs
– low parametrisations are needed
– assume τi = τ∀i ⇒ conditional precision is constant – bij = bi ⇒ independent coefficients of j (no preference given to neighboring information)
P 2 Yi ∼ Y−i | N( j,j∼i θ1yj , τ ) τ > 0, i = 1,..., n encode neighbor structure in a matrix ⇒ Adjacency matrix A or spatial weight matrix W
wij = 1ifi ∼ j, zero otherwise B = λw for some λ
03 June 2021 Markov Random Fields Page 61 For a legitimate precision matrix we need Q = I − λW to be positive definite, i.e. choose λ ∈ (λmax , λmin), with λ eigenvalues of W Departement of Mathematics
Statistical Models for observations of random fields Variogram
For every intrinsically stationary process the variogram exists and is unique → often parametrized with two more parameters → assume that process has an underlying parametrized variogram (as we rarely know the process explicitly)
03 June 2021 Markov Random Fields Page 62 Departement of Mathematics
References
03 June 2021 Markov Random Fields Page 63