6  Marginalization and m-separation

These notes were automatically generated by AI and lightly reviewed by the lecturer. They may still contain mistakes and factual errors.

Let’s study two graphical concepts: marginalization and m-separation. We will again start with Gaussian linear systems. Eliminating variables from their equations will tell us how to construct a marginal graph. Then the inverse covariance matrix will lead us to a graphical condition for conditional independence.

6.1 Marginalization

6.1.1 Eliminating a variable

Consider the following directed mixed graph and its Gaussian linear system. As before, \(\beta_{jk}\) is the coefficient for \(V_j\to V_k\), while \(\Lambda_{jk}=\operatorname{Cov}(E_j,E_k)\) is the weight of \(V_j\leftrightarrow V_k\).

Five vertices with directed edges V1 to V3 and V4, V2 to V3 and V5, and V3 to V4 and V5. Bidirected edges join V1 to V4 and V5. Every vertex has a bidirected loop.

The running graph. Blue edges are directed; red edges are bidirected, including the variance loops.

On a small screen, scroll the figure horizontally to read the labels.

The equations are

\[ \begin{aligned} V_1&=E_1,\\ V_2&=E_2,\\ V_3&=\beta_{13}V_1+\beta_{23}V_2+E_3,\\ V_4&=\beta_{14}V_1+\beta_{34}V_3+E_4,\\ V_5&=\beta_{25}V_2+\beta_{35}V_3+E_5, \end{aligned} \]

where \(E\sim\mathcal{N}(0,\Lambda)\). Among distinct noise terms, the only covariances permitted to be nonzero are \(\Lambda_{14}\) and \(\Lambda_{15}\).

Suppose we do not observe \(V_3\). Does the subvector \(\tilde V=(V_1,V_2,V_4,V_5)^T\) still follow a Gaussian linear system? Yes: substitute the equation for \(V_3\) into those for \(V_4\) and \(V_5\):

\[ \begin{aligned} V_1&=E_1,\\ V_2&=E_2,\\ V_4&=(\beta_{14}+\beta_{13}\beta_{34})V_1 +\beta_{23}\beta_{34}V_2+\tilde E_4,\\ V_5&=\beta_{13}\beta_{35}V_1 +(\beta_{25}+\beta_{23}\beta_{35})V_2+\tilde E_5, \end{aligned} \]

with

\[\tilde E_4=\beta_{34}E_3+E_4, \qquad \tilde E_5=\beta_{35}E_3+E_5.\]

The new noises are still jointly Gaussian. Algebraically this is variable elimination; probabilistically it gives the marginal distribution of the retained variables.

Are we fixing \(V_3\), or conditioning on it? No. We leave \(V_3\) unobserved and describe the joint distribution of the other four variables. Its randomness has not disappeared: \(E_3\) now appears in both \(\tilde E_4\) and \(\tilde E_5\).

What is the graphical counterpart of this calculation?

6.1.2 Blocking arcs

Recall that an arc (Definition 5.8) is a walk with no collider: no interior occurrence of a vertex has two arrowheads pointing into it. Directed walks and treks are arcs.

Definition 6.1.

An arc is blocked by \(L\subseteq V\) if it contains a non-endpoint belonging to \(L\).

Write \(W[V\rdpath V\mid L]\) for the matrix of sets of directed walks that are not blocked by \(L\). A single edge always qualifies because it has no non-endpoint. A longer qualifying walk must have all its internal vertices in \(L^c=V\setminus L\). Thus, in the walk algebra,

\[ \begin{aligned} W[V\rdpath V\mid L] ={}&W[V\to V]\\ &+W[V\to L^c]\, \bigl\{\mathrm{Id}+W[L^c\rdpath L^c\mid L]\bigr\}\, W[L^c\to V]. \end{aligned} \]

Here addition means union and multiplication concatenates walks. The middle factor stays entirely inside \(L^c\):

\[W[L^c\rdpath L^c\mid L]=\sum_{r\geq1}W[L^c\to L^c]^r.\]

The identity walk matrix \(\mathrm{Id}\) (Definition 5.5) allows that middle part to have length zero. The first and last edges then meet at a single vertex of \(L^c\).

Similarly, \(W[V\trek V\mid L]\) collects the unblocked treks. Writing its decomposition in the walk algebra is a useful exercise.

We will also use a relation without \(W[\cdot]\) to assert that the corresponding set is nonempty. For instance,

\[V_j\rdpath V_k\mid L\text{ in }G \quad\Longleftrightarrow\quad W[V_j\rdpath V_k\mid L\text{ in }G]\ne\emptyset.\]

6.1.3 The marginal graph

Write \(\mathbb{G}(V)\) for directed mixed graphs on vertex set \(V\). We use \(V\) both for the set of variables and for their vector; a retained set \(\tilde V\) similarly determines a subvector.

Definition 6.2.

For \(G\in\mathbb{G}(V)\) and \(\tilde V\subseteq V\), the marginal graph \(\tilde G=\operatorname{margin}_{\tilde V}(G)\) has vertex set \(\tilde V\) and edge sets determined by

\[ \begin{aligned} V_j\to V_k\text{ in }\tilde G &\quad\Longleftrightarrow\quad V_j\rdpath V_k\mid\tilde V\text{ in }G,\\ V_j\leftrightarrow V_k\text{ in }\tilde G &\quad\Longleftrightarrow\quad V_j\trek V_k\mid\tilde V\text{ in }G. \end{aligned} \]

Think of this as a map that compresses walks into edges. A directed walk whose internal vertices are all removed becomes a directed edge. A trek whose internal vertices are all removed becomes a bidirected edge. For example,

\[V_j\leftarrow U_1\leftrightarrow U_1\to V_k\]

becomes \(V_j\leftrightarrow V_k\) when \(U_1\) is removed. The self-loop carries the variance of the eliminated noise.

Is the blocking set the set we remove? In this definition it is the set we keep, \(\tilde V\). We only compress a walk if none of its non-endpoints is still represented as a retained variable. The conditioning heuristic is that observing an internal vertex blocks information along an arc. Here the notation \(\mid\tilde V\) imposes that graphical restriction; the resulting probability distribution is still a marginal distribution.

Return to eliminating \(V_3\). All single edges between retained vertices, including their loops, remain. The directed walks through \(V_3\) produce \(V_1\to V_5\) and \(V_2\to V_4\). The edges \(V_1\to V_4\) and \(V_2\to V_5\) already exist, but their coefficients also receive contributions through \(V_3\).

Vertices V1, V2, V4 and V5. V1 and V2 each point to both V4 and V5. Bidirected edges join V1 to V4, V1 to V5, and V4 to V5. All four variance loops remain.

The marginal graph after removing V3. The new bidirected edge joins V4 and V5. Directed edges are blue and bidirected edges are red.

On a small screen, scroll the figure horizontally.

The new bidirected edge comes from the trek \(V_4\leftarrow V_3\leftrightarrow V_3\to V_5\). This agrees with the algebra: \(\tilde E_4\) and \(\tilde E_5\) share \(E_3\), and their covariance is \(\beta_{34}\beta_{35}\Lambda_{33}\) in this example.

6.2 Marginalizing Gaussian linear systems

6.2.1 Marginalization by substitution

The graphical definition is motivated by the same elimination calculation in general. Write \(\mathbb{G}_A(V)\) for the acyclic directed mixed graphs.

Theorem 6.3.

Suppose \(G\in\mathbb{G}_A(V)\) and \(V\) satisfies the Gaussian linear system \(V=\beta^T V+E\) on \(G\), with weight function \(\sigma\). Then any subvector \(\tilde V\subseteq V\) satisfies a Gaussian linear system on \(\tilde G=\operatorname{margin}_{\tilde V}(G)\), with weights

\[ \begin{aligned} \tilde\beta_{jk} &=\sigma\bigl(W[V_j\rdpath V_k\mid\tilde V\text{ in }G]\bigr),\\ \tilde\Lambda_{jk} &=\sigma\bigl(W[V_j\trek V_k\mid\tilde V\text{ in }G]\bigr). \end{aligned} \]

Recall that \(\sigma\) (Definition 5.4) multiplies edge weights along a walk and adds the weights over a set of walks. Acyclicity makes these sums finite. It is a convenient assumption for our argument; marginalization can also be studied more generally.

Partial proof.

Let \(U=V\setminus\tilde V\) be the variables to eliminate. Partition the equations into two blocks:

\[ \begin{aligned} \tilde V&=\beta_{\tilde V\tilde V}^T\tilde V +\beta_{U\tilde V}^T U+E_{\tilde V},\\ U&=\beta_{\tilde V U}^T\tilde V+\beta_{UU}^T U+E_U. \end{aligned} \]

Solve the second equation for \(U\) and substitute into the first. Collecting the terms multiplying \(\tilde V\) gives

\[\tilde V= \bigl\{\beta_{\tilde V\tilde V} +\beta_{\tilde V U}(I-\beta_{UU})^{-1}\beta_{U\tilde V}\bigr\}^T \tilde V+\tilde E.\]

Now read the coefficient matrix graphically:

  • \(\beta_{\tilde V\tilde V}\) accounts for single directed edges between retained vertices.
  • \(\beta_{\tilde V U}\) enters the eliminated set through one directed edge.
  • \((I-\beta_{UU})^{-1}=I+\beta_{UU}+\beta_{UU}^2+\cdots\) accounts for zero or more directed steps entirely inside \(U\) (Lemma 5.2).
  • \(\beta_{U\tilde V}\) returns to the retained set through one directed edge.

These are exactly the directed walks from \(\tilde V\) to \(\tilde V\) not blocked by \(\tilde V\), giving the formula for \(\tilde\beta\). A retained internal vertex would still have its own equation, rather than being absorbed into this coefficient: this explains the blocking rule.

The new noise \(\tilde E\) is a linear combination of the original noises. Writing it out and checking that its covariance gives the stated trek formula for \(\tilde\Lambda\) is left as an exercise, together with the decomposition of unblocked treks.

6.2.2 Example: removing \(V_2\)

Let’s do a couple more examples to get familiar with the definition. This time retain \(\tilde V=\{V_1,V_3,V_4,V_5\}\) and eliminate \(V_2\).

Keep all single edges between retained vertices. The trek \(V_3\leftarrow V_2\leftrightarrow V_2\to V_5\) adds \(V_3\leftrightarrow V_5\). The resulting graph is:

Vertices V1, V3, V4 and V5. Directed edges go from V1 to V3 and V4 and from V3 to V4 and V5. Bidirected edges join V1 to V4 and V5 and V3 to V5. Every retained vertex has a variance loop.

Removing V2 adds the red bidirected edge between V3 and V5. V3 remains in the graph, and there is no bidirected edge between V4 and V5. Blue edges are directed.

On a small screen, scroll the figure horizontally.

Why not also add \(V_4\leftrightarrow V_5\)? Randomness generated at \(V_2\) can affect both variables, but its route into \(V_4\) goes through \(V_3\). We have kept \(V_3\), so this dependence is still represented by its outgoing edges.

For the formal check, consider the trek

\[V_4\leftarrow V_3\leftarrow V_2\leftrightarrow V_2\to V_3\to V_5.\]

It is indeed a trek, but it is blocked by \(\tilde V\): \(V_3\) occurs as a non-endpoint and belongs to the retained set. Eliminating the middle part \(V_3\leftarrow V_2\leftrightarrow V_2\to V_3\) contributes to the variance loop at \(V_3\); it does not remove \(V_3\) from the remaining walk or produce an edge between \(V_4\) and \(V_5\).

Only one retained non-endpoint is needed to block a trek. We do not need to block every internal vertex, or both occurrences of \(V_3\) separately.

6.2.3 Example: removing \(V_2\) and \(V_3\)

Now retain only \(\{V_1,V_4,V_5\}\). We can reach this set from either of the two previous marginal graphs (after removing \(V_3\) and after removing \(V_2\)):

Starting with V1, V2, V3, V4 and V5, the left route removes V3 then V2, while the right route removes V2 then V3. Both retain V1, V4 and V5.

Two elimination orders. Each box shows the retained variables; each arrow removes one variable.

On a small screen, scroll the figure horizontally.

  • Remove \(V_3\) first, then \(V_2\). The edge \(V_4\leftrightarrow V_5\) is already present after the first step; eliminating \(V_2\) gives further contributions to its weight.
  • Remove \(V_2\) first, then \(V_3\). The directed walk \(V_1\to V_3\to V_5\) now becomes \(V_1\to V_5\), and treks through \(V_3\) now produce \(V_4\leftrightarrow V_5\).

Both routes give the same graph:

V1 points to V4 and V5. Every pair among V1, V4 and V5 has a bidirected edge, and every vertex has a bidirected variance loop.

The marginal graph on V1, V4 and V5 is the same in either elimination order. Blue edges are directed; red edges are bidirected.

On a small screen, scroll the figure horizontally.

This is what we should expect: both calculations eliminate the same variables from the same linear system and describe the same marginal distribution.

6.3 Conditional independence and collider connections

6.3.1 The inverse covariance matrix

Gaussian models are particularly convenient for studying conditional independence. Conditioning one subvector on another still gives a Gaussian distribution, with a conditional mean that is linear in the variables we condition on. For two variables, conditional independence means that this bivariate conditional distribution has diagonal covariance.

The following lemma lets us read this property from the inverse covariance matrix.

Lemma 6.4.

If \(V\sim\mathcal{N}(0,\Sigma)\) with \(\Sigma\succ0\), then for distinct \(V_j,V_k\in V\),

\[\newcommand{\independent}{\mathrel{\rlap{\perp}\mkern2mu\perp}} V_j\independent V_k\mid V\setminus\{V_j,V_k\} \quad\Longleftrightarrow\quad (\Sigma^{-1})_{jk}=0.\]

Here \(\Sigma\succ0\) means positive definite. We will use the lemma without proof; the general probability definition of conditional independence comes later.

For our acyclic Gaussian linear systems with \(\Lambda\succ0\),

\[\Sigma=(I-\beta)^{-T}\Lambda(I-\beta)^{-1}, \qquad \Sigma^{-1}=(I-\beta)\Lambda^{-1}(I-\beta)^T.\]

Expanding an off-diagonal entry gives

\[ \begin{aligned} (\Sigma^{-1})_{jk} ={}&(\Lambda^{-1})_{jk} -\sum_\ell\beta_{j\ell}(\Lambda^{-1})_{\ell k}\\ &-\sum_\ell(\Lambda^{-1})_{j\ell}\beta_{k\ell} +\sum_{\ell,m}\beta_{j\ell}(\Lambda^{-1})_{\ell m}\beta_{km}. \end{aligned} \tag{6.1}\]

The rightmost factors use \(\beta_{k\ell}\) and \(\beta_{km}\) because the last matrix factor is transposed. How do these terms translate into walks?

6.3.2 Collider-connected walks

For a moment, imagine replacing an entry of \(\Lambda^{-1}\) by an entry of \(\Lambda\). The four terms would suggest the shapes

\[ \begin{gathered} V_j\leftrightarrow V_k,\qquad V_j\to V_\ell\leftrightarrow V_k,\\ V_j\leftrightarrow V_\ell\leftarrow V_k,\qquad V_j\to V_\ell\leftrightarrow V_m\leftarrow V_k. \end{gathered} \]

Every non-endpoint here is a collider. The next result makes this heuristic precise: for \(\Lambda^{-1}\), a sequence of bidirected edges takes the place of a single edge, preserving the collider pattern.

Definition 6.5.

Vertices are collider-connected if there is a walk between them on which every non-endpoint is a collider. Write this relation as \(V_j\colliderconn V_k\).

The star permits zero or more colliders. In particular, a single edge qualifies. The half-arrowheads at the outer ends impose no restriction on the endpoint marks: each can be an arrowhead or a tail.

Lemma 6.6.

Suppose \(V\) follows a Gaussian linear system on \(G\in\mathbb{G}_A(V)\) with \(\Lambda\succ0\). For distinct \(V_j,V_k\in V\),

\[\text{not }V_j\colliderconn V_k\text{ in }G \quad\Longrightarrow\quad V_j\independent V_k\mid V\setminus\{V_j,V_k\}.\]

Positive definiteness gives \(\Lambda_{jj}>0\) for every \(j\). Since the noise covariance respects the graph, all bidirected variance loops must be present.

Proof.

To see why the lemma holds, first set \(\beta=0\). We only need to understand \(\Lambda^{-1}\). If \(V_j\) and \(V_k\) cannot be joined by a sequence of bidirected edges, they belong to different bidirected connected components. Order the variables by those components: \(\Lambda\) is block diagonal, and its inverse has the same block structure,

\[\Lambda=\begin{pmatrix} *&0\\0&*\end{pmatrix} \quad\Longrightarrow\quad \Lambda^{-1}=\begin{pmatrix} *&0\\0&*\end{pmatrix}.\]

Here the stars denote matrix blocks. An entry joining different blocks is therefore zero in the inverse too.

Now restore \(\beta\). A nonzero entry of \(\Lambda^{-1}\) can join only vertices in the same bidirected component. Each nonzero summand in Equation (6.1) therefore requires a walk of the corresponding form:

The four summands are paired with their required walks: the inverse entry jk needs a bidirected connection from Vj to Vk; beta j-ell adds an arrow from Vj; beta k-ell adds an arrow from Vk; and the product with both beta factors adds inward-pointing arrows at both ends.

Each nonzero summand requires a collider-connected walk. Red links form a bidirected connection; blue directed edges point into it. Every interior vertex is a collider.

On a small screen, scroll the figure horizontally.

For a diagonal entry of \(\Lambda^{-1}\), use the variance loop at that vertex. Thus any nonzero summand in Equation (6.1) supplies a collider-connected walk. If there is no such walk, every term is zero, and the inverse covariance lemma (Lemma 6.4) gives the required conditional independence.

6.4 m-separation

6.4.1 Conditioning on a subset

There is something unsatisfactory about the last rule (Lemma 6.6): we must condition on all the other variables. What if we want to condition only on a subset \(L\)? We need a more general notion of blocking, one that allows colliders.

Definition 6.7 (blocking and ancestral blocking).

A walk in \(G\in\mathbb{G}(V)\) is blocked (respectively, ancestrally blocked) by \(L\subseteq V\) if either:

  1. it contains a collider \(m\) with \(m\notin L\) (respectively, \(m\notin L\) and no directed walk from \(m\) to any vertex of \(L\)); or
  2. it contains a non-colliding non-endpoint \(m\) with \(m\in L\).

For an arc there are no colliders, so only the second condition applies, recovering our earlier definition (Definition 6.1). For a general walk to be unblocked, every collider must be in \(L\), and every non-colliding non-endpoint must be outside \(L\).

We will mainly use the first, walk-based blocking rule here.

Write

\[W[V\mconn V\mid L]\]

for the matrix of walks not blocked by \(L\). The star allows any number of colliders, and the half-arrowheads leave the endpoint marks unrestricted. Without a blocking restriction, this shape can describe any walk: split it at its colliders into collider-free pieces.

Definition 6.8.

For disjoint vertex sets \(J,K,L\subseteq V\), say that \(J\) and \(K\) are m-separated by \(L\) if no walk from a vertex of \(J\) to a vertex of \(K\) is unblocked by \(L\). In the relation notation this is \(\text{not }J\mconn K\mid L\).

6.4.2 The conditional independence theorem

Theorem 6.9.

Suppose \(V\) follows a Gaussian linear system on \(G\in\mathbb{G}_A(V)\) with \(\Lambda\succ0\). Then, for all disjoint \(J,K,L\subseteq V\),

\[\text{not }J\mconn K\mid L\text{ in }G \quad\Longrightarrow\quad J\independent K\mid L.\]

The sets on the right denote the corresponding random subvectors. In words: if every walk from \(J\) to \(K\) is blocked by \(L\), then \(J\) and \(K\) are conditionally independent given \(L\).

6.4.3 Proof strategy

The idea is to use marginalization to reduce this question to Lemma 6.6. For a pair \(V_j,V_k\), retain only \(\tilde V=\{V_j,V_k\}\cup L\). In the marginal system, conditioning on \(L\) now means conditioning on all the other variables. If the original blocking condition implies that \(V_j\) and \(V_k\) are not collider-connected in this smaller graph, Lemma 6.6 gives \(V_j\independent V_k\mid L\).

The key remaining step is therefore graphical: how does marginalization preserve the relations between walks? We will develop that argument and prove the theorem in the next lecture (see Theorem 7.6).

© 2026 Qingyuan Zhao. Except where otherwise noted, these lecture notes are licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). Third-party material is excluded from this licence; see the individual credits and rights notices. Public-domain material remains in the public domain.