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