| From | → To | β | ×W (Moderator) | β_int |
|---|
| Variable | Distribution | Mean / p | SD / – |
|---|
Generate the simulated data, then change the model formula and observe what happens:
· Omit the confounder (remove from brms/glmmTMB code) → β(X) becomes biased (Confounding Bias)
· Include the collider (add to formula) → opens spurious association between X and Y (Berkson Bias)
· Control for mediator when estimating total effect → underestimates β(X) because the indirect path is blocked
The true β is in the simulation code — compare it with the estimate from the fitted model!
An instrumental variable Z allows causal identification even when an unmeasured confounder U exists. Z must satisfy three conditions: (1) Relevance: Z→X (Z influences the exposure), (2) Exclusion: Z has no direct effect on Y other than through X, (3) Independence: Z shares no common causes with Y (Z is independent of U).
Frequentist: Two-Stage Least Squares (2SLS) via ivreg(Y ~ X | Z). Bayesian: joint model of both equations with correlated residuals — rescor = TRUE estimates ρ (confounding strength of U) directly as a posterior.
Angrist & Pischke (2009). Mostly Harmless Econometrics. Princeton UP. — McElreath (2020). Statistical Rethinking, Ch. 15.
When U confounds X and Y, but a mediator M exists with (1) M on all paths X→Y, (2) no backdoor X→M, (3) all backdoors M→Y blocked by X — then the causal effect is identifiable without measuring U.
Front Door formula: P(Y|do(X)) = Σm P(M|X) · Σx' P(Y|M,X=x') · P(X=x'). In the linear case: β_FD = β_XM × β_MY, where β_MY is estimated by controlling for X (X blocks M←X←U→Y).
Bayesian: multivariate brms model with rescor = FALSE yields the joint posterior of β_XM and β_MY — their product is the total causal effect as a full posterior distribution.
Pearl (2009). Causality, Ch. 3.3. Cambridge UP. — Pearl, Glymour & Jewell (2016). Causal Inference in Statistics: A Primer. Wiley.