Bivalent, Exhaustive Mediators for Front-Door Identification with Bayesian SEMs
Data Science @ PandaDoc
and Open Source Contributor @ PyMC
2026-11-12
Who am I?
Link to my website
Code or it didn’t Happen
The companion notebook, with every model and sensitivity analysis in this talk, is here. The worked example is drawn from the SEM chapter of Bayesian Causal Inference (Vincent & Forde, in preparation).
The front-door criterion identifies a causal effect through unmeasured confounding, with no instrument required.
So why does almost nobody use it?
The argument: the mediator should be built, not found. Identification is a piece of information architecture.
Act I: The Demand of the Front Door. Why a single mediator node almost never qualifies, and why identification is an architecture rather than a discovery
Act II: Building the Mechanism. A bivalent mediator set for job satisfaction, encoded in two matrices of a Bayesian SEM
Act III: Auditing the Architecture. Relaxing the zeros, recovering the parameters, and springing a leak
Pearl (1995): \(M\) identifies the effect of \(X\) on \(Y\) when
Then, despite the unmeasured \(U\):
\[P(y \mid do(x)) = \sum_m P(m \mid x) \sum_{x'} P(y \mid m, x') P(x')\]
Two well-identified pieces, \(X \to M\) and \(M \to Y \mid X\), are chained together.
What is missing is the construction step.
Every credible design decides where variation is allowed to flow. None of these plans is found in the data.
| Design | Unwanted variation is… | The argument you owe |
|---|---|---|
| Propensity score weighting | rebalanced: reweighting builds a pseudo-population where treatment is independent of the observed covariates | every confounder is observed, and overlap holds |
| Double ML | residualised away: flexible nuisance models partial it out of \(T\) and \(Y\) | every confounder is observed |
| Mundlak device | absorbed by group means: cluster means of the covariates soak up the correlation between group effects and treatment | the unobserved confounding lives at the group level |
| Control-function IV | modelled explicitly: the first-stage residual \(\hat v\) enters the outcome equation | relevance and exclusion of the instrument |
| Front-door SEM | quarantined: confounding may live in \(\text{Cov}(\zeta_X, \zeta_Y)\), and nowhere else | the mechanism is exhaustive and unconfounded |
A structural equation model is a blueprint of permitted covariances. The front-door design is one floor plan: the effect must walk through the mechanism, the confounding must stay in its room.
Houghton & Jinkerson (2007): 12 indicators, 4 constructs; 263 observations simulated from their published correlations.
EBA, ST, MIDA1–DA3UF1, UF2, FORJW1–JW3The mechanism is bivalent: CTS suppresses a negative construct and raises a positive one.
The front-door claim: these two routes exhaust CTS’s influence: a premise to argue, not a finding.
Both models share the marginal covariance
\[\Sigma_y = \Lambda(I - \color{blue}{B})^{-1}\color{blue}{\Psi_\zeta}(I - \color{blue}{B})^{-\top}\Lambda^\top + \Psi\]
and the mechanism is encoded entirely in \(\color{blue}{B}\) and \(\color{blue}{\Psi_\zeta}\).
\[\color{blue}{B} = \begin{bmatrix} \overbrace{0}^{Sat} & \overbrace{\beta_{sw}}^{WB} & \overbrace{\beta_{sd}}^{DTS} & \overbrace{\color{red}{0}}^{CTS} \\ 0 & 0 & \color{red}{0} & \beta_{wc} \\ 0 & 0 & 0 & \beta_{dc} \\ 0 & 0 & 0 & 0 \end{bmatrix}\]
Direct edge CTS → Sat and the path DTS → WB are removed.
\[\color{blue}{\Psi_\zeta} = \begin{bmatrix} \psi_{s} & 0 & 0 & \color{blue}{\psi_{sc}} \\ 0 & \psi_{w} & \color{blue}{\psi_{wd}} & 0 \\ 0 & \color{blue}{\psi_{wd}} & \psi_{d} & 0 \\ \color{blue}{\psi_{sc}} & 0 & 0 & \psi_{c} \end{bmatrix}\]
Exactly two covariances stay free: treatment–outcome confounding \(\psi_{sc}\), and structure inside the mediator set \(\psi_{wd}\).
Every other zero is the formal content of “the mechanism explains everything.”
FRONTDOOR_PATHS = [
("dysfunctional", "constructive"), # CTS -> DTS
("well being", "constructive"), # CTS -> WB
("satisfaction", "well being"), # WB -> Sat
("satisfaction", "dysfunctional"), # DTS -> Sat
]
FRONTDOOR_COVS = [
("satisfaction", "constructive"), # confounding we survive
("well being", "dysfunctional"), # inside the mechanism
]
with pm.Model(coords=coords) as frontdoor_model:
Lambda, Psi = measurement_model(sample_df)
Psi_zeta = make_Psi_zeta(FRONTDOOR_COVS)
betas = pmd.Normal("mu_betas", 0, 1, dims="frontdoor_paths")
B = set_edges(pt.zeros((4, 4)), FRONTDOOR_PATHS, betas.values)
inv = pt.linalg.solve(pt.eye(4) - B, pt.eye(4))
Sigma_y = Lambda @ inv @ Psi_zeta @ inv.T @ Lambda.T + Psi
pm.MvNormal("likelihood", mu=0, cov=Sigma_y, observed=observed_data)| Total effect CTS → Sat | 94% HDI | Posterior SD | SRMR | |
|---|---|---|---|---|
| Saturated | +0.19 | [−1.25, +1.62] | 0.77 | 0.054 |
| Front-door | +0.14 | [+0.01, +0.27] | 0.07 | 0.053 |
The saturated model is not identified: its interval is mostly prior. The front-door model is identified, and its interval just excludes zero. Global fit is unchanged: the restrictions trade one-for-one for identification, so fit cannot test them.
Two different gains from building:
Muthén & Asparouhov (2012): replace each exact zero with \(\text{Normal}(0, \sigma)\) and watch the conclusion.
# Fix every parameter at the fitted values,
# plus a direct leak the front-door model forbids
with pm.do(generator, {**truth, "leak": [delta]}):
y = pm.sample_prior_predictive(draws=1)[
"prior"]["likelihood"] # one synthetic survey, n = 263
# Condition a fresh front-door model on it
with pm.observe(build_frontdoor(observed=None),
{"likelihood": y}):
idata = pm.sample()With \(\delta = 0\) the model recovers what generated the data: the total-effect HDI covers the truth in 8 / 8 replicates. But the estimates are noisy at \(n = 263\), because the CTS → mediator paths are small.
The recipe, applied
“SEM is an inference engine that takes in two inputs, qualitative causal assumptions and empirical data, and derives two logical consequences of these inputs: quantitative causal conclusions and statistical measures of fit for the testable implications of the assumptions… Fitting the data does not ”prove” the causal assumptions, but it makes them tentatively more plausible.”
– Bollen & Pearl, Eight Myths about Causality and Structural Equation Models
“The mediator is not found.
It is built.”
Resources
Building the Mechanism | Causal Data Science Meeting 2026