Bivalent, Exhaustive Mediators for Front-Door Identification with Bayesian SEMs
Data Science @ PandaDoc
and Open Source Contributor @ PyMC
2026-11-12
Who am I?
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 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 | confined: 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 a floor plan: the effect must walk through the mechanism, the confounding must be boxed in.
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 dysfunctional thinking and raises well-being.
The front-door claim: these two routes exhaust CTS’s influence. This is the argument to be made.
Both fit the same data. Everything that separates them is an argument for the deletions.
The effect. Whatever CTS does to satisfaction arrives with a sign: a lift (more well-being) or relief (less dysfunctional thinking). A positive and a negative pole are absorbing: influence of either valence must pass through one of them, so no third route is left.
Two premises left, one for each deletion:
The confounding. Unmeasured causes sort the same way, by what they act on:
| Unmeasured cause | Acts on | In the front-door model |
|---|---|---|
| Workplace-specific: manager, job quality, coaching culture | CTS and satisfaction | the one covariance left open: the confounding the design survives. Measurable parts can enter as controls; only the residual is left to it |
| General disposition: temperament, trait affect | the two poles → satisfaction | absorbed: whatever its sign, it reaches a job-specific outcome only through affect |
Both candidate 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}\]
The edges CTS → Sat and 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}\).
The two premises are now zeros: affect is the only channel is the red zero on CTS → Sat in \(B\); uptake isn’t temperamental is the zeros between CTS and the poles in \(\Psi_\zeta\). Every other zero is the formal content of “the mechanism carries the whole effect.”
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 zeros are spent entirely on identification and leave nothing over, so fit cannot test them.
Two gains from building:
Muthén & Asparouhov (2012): replace each exact zero with \(\text{Normal}(0, \sigma)\) and watch the conclusion.
Sensitivity Analysis is vital to all causal inference architectures: the estimate is exactly as credible as the argument that nothing leaks around the mechanism.
# 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.
“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
Resources
The exhaustiveness argument sorts unmeasured causes into workplace factors (left free in \(\psi_{sc}\)) and dispositions (absorbed by the mediators). What it does not cover:
The remedy is the recipe’s: measure the route (performance, perceived support) or the confounder (manager, team) and build it into the model. A2 shows what that looks like.
Even unmeasured, manager-level confounding has an architecture: with team identifiers, the Mundlak device from Act I absorbs it in team means of CTS.
The recipe, applied
Building the Mechanism | Causal Data Science Meeting 2026