Foundations to Frontier
Tests
A. Mathematical Foundations › A5 Statistics › Causal inference

Causal Discovery

Can we learn the causal graph itself from data? Partly. Conditional-independence tests reveal the skeleton and the v-structures (the PC algorithm), score-based search compares graphs by penalized likelihood (BIC, GES), and asymmetries such as non-Gaussian noise can even orient a single arrow (LiNGAM). You will implement PC with Fisher-z tests and Meek's orientation rule, score DAGs with BIC, orient a pair with non-Gaussianity, and learn the assumptions (causal sufficiency, faithfulness) and limits that make discovery hypothesis generation rather than proof.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Detective work on data

Suppose you have logs of wheel torque, slope, slip, odometry error and localization drift, but no one has drawn the causal graph. A detective notices patterns. Torque and slope have nothing to do with each other on their own, but both are related to slip. That pattern means both arrows point into slip. Odometry error is related to torque only through slip. Clues like these let an algorithm sketch the graph.

Some arrows can’t be oriented from passive data alone. For those you still need experiments or physics.

Finding the arrow's direction from data alone
residual of y|x vs x
dependence score 0.187
residual of x|y vs y
dependence score 0.880
inferred direction x → y (truth: x → y)
Least squares always makes the residual uncorrelated with the regressor, but only the true causal direction makes it independent. With uniform noise the wrong-direction residual plot (right) has a parallelogram shape whose spread depends on the regressor. With Gaussian noise, both directions are exactly linear-Gaussian models with the same fit, so observational data can't tell them apart (Markov equivalence). That's why constraint-based methods like PC rely on v-structures, and LiNGAM relies on non-Gaussianity.
Why engineers care

Fault propagation in spacecraft subsystems, root causes in manufacturing lines, and the interactions in a robot’s software stack are often unknown in advance. Causal discovery proposes candidate graphs from telemetry. Engineers then test them with targeted interventions.

📝 Quick check (Level 0)
0/3 answered
  1. 1. Causal discovery tries to learn…
  2. 2. Two independent causes that become related through a common effect reveal…
  3. 3. Can passive data always orient every arrow?

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

What’s learnable

Under the causal Markov condition and faithfulness (A5.3-3), and with causal sufficiency (no hidden common causes), observational data identify the DAG only up to its Markov equivalence class: the skeleton plus the v-structures. This is drawn as a CPDAG, with some edges directed and the rest undirected.

The PC algorithm (Spirtes, Glymour and Scheines)

  1. Start with a complete undirected graph.
  2. For conditioning-set sizes 0, 1, 2, …, remove edge i−ji - j if i⊥j∣Si\perp j\mid S for some SS among their neighbours. Record SS as the separating set.
  3. For each triple i−k−ji - k - j with i,ji, j non-adjacent: if k∉Sijk\notin S_{ij}, orient it as i→k←ji\to k\leftarrow j.
  4. Propagate with Meek’s rules. For example, if a→b−ca\to b - c and a,ca, c are non-adjacent, orient b→cb\to c. Otherwise bb would be a new collider.

For linear-Gaussian data, test zero partial correlation with the Fisher z: z=12log⁡1+r1−rn−∣S∣−3z = \tfrac12\log\frac{1 + r}{1 - r}\sqrt{n - |S| - 3}.

📝 Quick check (Level 1)
0/3 answered
  1. 1. From observational data you can identify the DAG up to…
  2. 2. PC removes an edge when…
  3. 3. Causal sufficiency means…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 45 minUndergraduate students and practising engineers.

Score each DAG by penalized likelihood, then search. For linear-Gaussian SEMs, BIC decomposes over nodes:

BIC(G)=∑j[−n2log⁡σ^j∣pa⁡j2−∣pa⁡j∣+22log⁡n]\text{BIC}(G) = \sum_j\Big[-\frac n2\log\hat\sigma^2_{j\mid\operatorname{pa}_j} - \frac{|\operatorname{pa}_j| + 2}2\log n\Big]

Markov-equivalent DAGs get identical scores. GES (Chickering, 2002) searches over equivalence classes, adding and then removing edges greedily, and is consistent. NOTEARS (Zheng et al., 2018) turns acyclicity into a smooth constraint tr⁡(eW∘W)−d=0\operatorname{tr}(e^{W\circ W}) - d = 0 for gradient-based learning.

Beyond equivalence: functional asymmetries

  • LiNGAM (Shimizu et al., 2006): linear with non-Gaussian noise. Only the true direction leaves a residual independent of the regressor, so the full DAG is identifiable.
  • Additive noise models (Hoyer et al., 2009): Y=f(X)+NY = f(X) + N with N⊥XN\perp X. The reverse model generally fails independence.
  • Interventional data: each intervention orients the edges touching its target (Eberhardt, Glymour and Scheines, 2005; Hauser and Bühlmann, 2012).

Hidden confounders and assumptions

With latent common causes, FCI outputs a PAG, with marks for “possibly confounded” edges. Faithfulness can fail through near-cancellations. Finite-sample tests make errors that propagate. Treat discovered graphs as hypotheses.

🐍 Exercise 1: the PC algorithm
Implement PC with Fisher-z partial-correlation tests, v-structure orientation and Meek's rule 1. Recover a 5-node rover graph from data, and confirm that a lone chain stays undirected.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Gaussian BIC scores for Markov-equivalent DAGs are…
  2. 2. LiNGAM identifies direction using…
  3. 3. With hidden confounders, a suitable algorithm is…

Level 3: Advanced

★★★★☆ Advanced⏱ 45 minGraduate level, with full derivations and proofs.

Why v-structures are identifiable

In i→k←ji\to k\leftarrow j, i⊥ji\perp j marginally (or given some set without kk), but not given kk. In every other orientation of i−k−ji - k - j (chain or fork), i⊥j∣ki\perp j\mid k, and conditioning on kk is needed to separate them. So the separating set reveals the collider. ∎

Why Gaussian pairs are not orientable

If (X,Y)(X, Y) is bivariate Gaussian, both Y=bX+NY = bX + N and X=b′Y+N′X = b'Y + N' hold with Gaussian N′⊥YN'\perp Y. For jointly Gaussian variables, uncorrelated means independent. Both models generate the same distribution. ∎ For non-Gaussian noise, the Darmois–Skitovich theorem says the backward residual N′=(1−bb′)X−b′NN' = (1 - bb')X - b'N can’t be independent of Y=bX+NY = bX + N unless the variables are Gaussian.

Complexity and consistency

PC’s worst case is exponential in the maximum degree. For sparse graphs it’s polynomial, and it scales to thousands of variables. Under faithfulness with consistent tests and αn→0\alpha_n\to0 suitably, it’s consistent (Kalisch and Bühlmann, 2007). Strong faithfulness (bounded-away partial correlations) is needed for uniform consistency (Uhler et al., 2013).

Exercise 3.1: Structural Hamming distance

True: A → B → C → D. Estimated: B → A, B → C, C → D, A → D. One reversed edge plus one extra edge, so SHD = 2.

📝 Quick check (Level 3)
0/3 answered
  1. 1. For a v-structure i → k ← j, the separating set of i and j…
  2. 2. In a bivariate Gaussian, both causal directions…
  3. 3. PC is efficient for…

Level 4: Expert

★★★★★ Expert⏱ 40 minResearchers: original papers and open problems.

Orienting an edge from telemetry

PC leaves some edges undirected. In a pair like motor temperature ↔ current draw, non-Gaussian operating noise can settle the direction: regress both ways and check which residual is independent of its regressor. Exercise 2 shows near-perfect accuracy with uniform noise and a coin flip with Gaussian noise. That limit is fundamental, not a weakness of the method.

🐍 Exercise 2 (research): direction from non-Gaussianity
Implement a LiNGAM-style pairwise direction test using a higher-moment independence score between regressor and residual. Measure accuracy with uniform vs Gaussian noise.

Causal discovery in AI, robotics and aerospace

  • Fault diagnosis and root-cause analysis: learned causal graphs over telemetry channels localize the source of anomalies (Budhathoki et al., 2022; Ikram et al., 2022).
  • Time-series causal discovery: PCMCI for autocorrelated sensor data (Runge et al., 2019), widely used on Earth-science and climate data.
  • Robot learning: discovering causal structure for manipulation from interventions (Lee et al., 2021, “Causal reasoning in simulation for structure and transfer learning of robot manipulation policies”).
  • Differentiable structure learning (NOTEARS, DAG-GNN) embedded in neural models (Zheng et al., 2018; Yu et al., 2019).
  • Benchmarks and pitfalls: varsortability (results that hinge on variance scaling) can make some continuous methods look better than they are (Reisach, Seiler and Weichwald, 2021).

References

  1. P. Spirtes, C. Glymour, R. Scheines (2000). Causation, Prediction, and Search, 2nd ed. MIT Press.
  2. C. Meek (1995). “Causal inference and causal explanation with background knowledge.” UAI.
  3. D. M. Chickering (2002). “Optimal structure identification with greedy search.” JMLR, 3.
  4. S. Shimizu, P. Hoyer, A. Hyvärinen, A. Kerminen (2006). “A linear non-Gaussian acyclic model for causal discovery.” JMLR, 7.
  5. P. Hoyer, D. Janzing, J. Mooij, J. Peters, B. Schölkopf (2009). “Nonlinear causal discovery with additive noise models.” NeurIPS.
  6. M. Kalisch, P. Bühlmann (2007). “Estimating high-dimensional directed acyclic graphs with the PC-algorithm.” JMLR, 8.
  7. X. Zheng, B. Aragam, P. Ravikumar, E. Xing (2018). “DAGs with NO TEARS: continuous optimization for structure learning.” NeurIPS.
  8. J. Runge, P. Nowack, M. Kretschmer, S. Flaxman, D. Sejdinovic (2019). “Detecting and quantifying causal associations in large nonlinear time series datasets.” Science Advances, 5(11).
  9. A. Reisach, C. Seiler, S. Weichwald (2021). “Beware of the simulated DAG! Causal discovery benchmarks may be easy to game.” NeurIPS.
  10. J. Peters, D. Janzing, B. Schölkopf (2017). Elements of Causal Inference. MIT Press.