Building the Mechanism

Bivalent, Exhaustive Mediators for Front-Door Identification with Bayesian SEMs

Nathaniel Forde

Data Science @ PandaDoc

and Open Source Contributor @ PyMC

2026-11-12

Preliminaries

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).

Bayesian Causal Inference (Vincent & Forde), coming soon
  • Mailing list is available on the website.
  • Confirm email to be notified as we release chapters online.

The Pitch

The front-door criterion identifies a causal effect through unmeasured confounding, with no instrument required.

So why does almost nobody use it?

  • It asks the mediator to carry everything: every directed path from \(X\) to \(Y\).
  • Any effect that leaks around the mediator breaks identification.
  • Read as a demand on a single observed node, the criterion almost never holds.

The argument: the mediator should be built, not found. Identification is architecture.

Agenda

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

Act I: The Demand of the Front Door

The Front-Door Criterion

Pearl (1995): \(M\) identifies the effect of \(X\) on \(Y\) when

  1. \(M\) intercepts every directed path from \(X\) to \(Y\)
  2. There is no unblocked back-door path from \(X\) to \(M\)
  3. Every back-door path from \(M\) to \(Y\) is blocked by \(X\)

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.

Why It Is Rarely Used

  • A bare DAG node is a single indicator: loading fixed at 1, no measurement error, so a noisy proxy lets part of the effect slip past it.
  • Asked to exhaust a pathway in social, marketing or organisational data, it usually fails.
  • The pieces exist: Pearl allows a mediator set; Kuroki (2000) and Kuroki & Cai (2004) treat front-door in linear SEMs; multi-indicator latents are standard practice.

What is missing is the construction step.

Identification as Information Architecture

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.

Act II: Building the Mechanism

The Job Satisfaction Constructs

Houghton & Jinkerson (2007): 12 indicators, 4 constructs; 263 observations simulated from their published correlations.

  • CTS, constructive thought strategies (treatment): EBA, ST, MI
  • DTS, dysfunctional thinking: DA1–DA3
  • WB, well-being: UF1, UF2, FOR
  • Satisfaction (outcome): JW1–JW3

The 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.

Two Candidate Models

Same constructs, same data, different assumptions

  • Saturated: assumes nothing about the mechanism. A direct edge, a DTS → WB edge, and every disturbance covariance are left free.
  • Front-door: deletes CTS → Sat, trades DTS → WB for a free covariance, and leaves only the treatment–outcome confounding open outside the mechanism.

Both fit the same data. Everything that separates them is an argument for the deletions.

Arguing Exhaustiveness

Two poles absorb both valences

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:

  • affect is CTS’s only channel to satisfaction → no direct edge CTS → Sat
  • uptake of CTS isn’t driven by temperament → no common cause of CTS and the poles

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

One Covariance Form, Two Matrices

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.”

The Mechanism in Code

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)
  • The edge list is the mechanism.
  • The permitted covariances are the only doors.
  • Every other zero is a wall we have to defend.
  • The total effect is read off \((I - B)^{-1}\).

The Payoff

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.

What the Second Pole Buys

  • CTS raises a positive force (well-being: +0.14 × +0.69 ≈ +0.09) and suppresses a negative one (dysfunctional thinking: −0.16 × −0.31 ≈ +0.05).
  • Had we found only well-being, the suppression route would become a leak, and the front door would miss about a third of the effect.

Two gains from building:

  • Several indicators per construct handle measurement error.
  • Opposite poles handle exhaustiveness: drop one, and its valence of influence becomes a leak.

Act III: Auditing the Architecture

Relaxing the Zeros

Muthén & Asparouhov (2012): replace each exact zero with \(\text{Normal}(0, \sigma)\) and watch the conclusion.

  • The mean barely moves (≈ 0.14–0.18): the data are nearly silent about the direct edge.
  • The interval does all the moving: at \(\sigma = 0.05\) the HDI already reaches zero; at \(\sigma = 0.5\) it is almost as wide as the saturated model’s.
  • Re-admitting DTS → WB changes nothing. One zero, CTS → Sat, carries the precision.

Sensitivity Analysis is vital to all causal inference architectures: the estimate is exactly as credible as the argument that nothing leaks around the mechanism.

Simulating from the Mechanism

Does the model recover the truth it generated?

# 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.

Springing a Leak

  • In a linear SEM a front door recovers only what flows through its mediators, so a leak of size \(\delta\) biases it by exactly \(-\delta\) (dotted line).
  • The simulations track this, noisily, with five replicates per \(\delta\). Coverage of the true effect falls to zero by \(\delta = 0.3\).
  • The leak is absorbed as confounding: \(\rho(\zeta_{CTS}, \zeta_{Sat})\) rises from 0.10 to 0.27, and SRMR never moves.
  • Read with Fulcher et al. (2020), a leaky front door still estimates the mediated effect. What it gets wrong is the total.

Conclusion

Identification is Built

“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 front-door restrictions are not tested by global fit statistics: they are spent entirely on identification.
  • So the warrant for the estimate lives in the construction: the choice of constructs, their measurement, and the argument that they exhaust the pathway.
  • Bayesian SEMs make that warrant auditable: soften the zeros, simulate the leaks, and report how much of the answer the architecture supplies.
  • The recipe: build the constructs, argue the deletions, encode them as zeros, audit what each zero supplies.

Resources

Resources

  • Companion notebook: github.com/NathanielF/…/frontdoor_sem_sensitivity.ipynb
  • PyMC: pymc.io
  • Pearl (1995), “Causal Diagrams for Empirical Research,” Biometrika
  • Kuroki (2000), “Selection of Post-Treatment Variables for Estimating Total Effect,” J. Japan Stat. Soc.
  • Kuroki & Cai (2004), “Selection of Identifiability Criteria for Total Effects,” UAI
  • Muthén & Asparouhov (2012), “Bayesian SEM: A More Flexible Representation of Substantive Theory,” Psych. Methods
  • Houghton & Jinkerson (2007), “Constructive Thought Strategies and Job Satisfaction,” J. Business & Psychology
  • Bollen & Pearl (2013), “Eight Myths about Causality and SEMs”
  • Glynn & Kashin (2018), “Front-Door Versus Back-Door Adjustment with Unmeasured Confounding,” JASA
  • Fulcher, Shpitser, Marealle & Tchetgen Tchetgen (2020), “Robust Inference on Population Indirect Causal Effects: The Generalized Front Door Criterion,” JRSS-B
  • Bellemare, Bloem & Wexler (2024), “The Paper of How: Estimating Treatment Effects Using the Front-Door Criterion,” Oxford Bull. Econ. Stat.

Bayesian Causal Inference (Vincent & Forde), coming soon

See: https://bayesian-causal-inference.com/

A1: Where the Argument Is Weakest

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:

  • a behavioural route: constructive thinking → performance → rewards → satisfaction, which bypasses affect entirely;
  • shared measurement: one self-report survey, so method variance is a candidate common cause of everything;
  • workplace factors that reach the poles: a good manager can lift well-being as well as satisfaction, opening WB ← manager → Sat, a back door from mediator to outcome that CTS cannot block.

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.

A2: Building in the Missing Route

A people-analytics design with the leak measured

The recipe, applied

  1. Build: after a thought-strategy course, measure the change in CTS, well-being, dysfunctional thinking and perceived support.
  2. Argue: the course reaches satisfaction only through them. Who gets sent is the confounding the design survives.
  3. Encode: the argument as zeros in \(B\) and \(\Psi_\zeta\).
  4. Audit: relax the zeros, simulate leaks, recover parameters.
  • If enrolment can be randomised, just compare the groups. The front door is for selected enrolment, the usual HR case.
  • A dated course makes the graph easier to believe: time order is built in, and the confounder has a name.