Saturday, October 31, 2026
HomeData ScienceCausal Discovery โ€“ PC Algorithm, LiNGAM, NOTEARS and Learning DAGs from Observational...

Causal Discovery โ€“ PC Algorithm, LiNGAM, NOTEARS and Learning DAGs from Observational Data

Table of Content

📋 KEY INSIGHTS

  • Causal discovery algorithms automatically learn the causal graph (DAG or CPDAG) from observational data โ€” without running experiments โ€” by exploiting conditional independence relationships encoded in the data. Unlike causal inference (which estimates the effect of a known intervention given a known graph), causal discovery addresses the upstream problem of recovering the graph structure itself from passive observation.
  • The PC algorithm (Spirtes, Glymour, Scheines, 1991) is the foundational constraint-based causal discovery method: it starts with a complete undirected graph, removes edges between variables that are conditionally independent (d-separated) given some subset of other variables, and then orients remaining edges by identifying v-structures (X โ†’ Z โ† Y where X and Y are not adjacent) and applying Meek orientation rules. PC is sound and complete under causal Markov and faithfulness assumptions, but its accuracy degrades in high dimensions due to unreliable conditional independence tests.
  • LiNGAM (Linear Non-Gaussian Acyclic Model, Shimizu et al., 2006) exploits the fact that in a linear structural equation model X_j = ฮฃ_k b_jk X_k + ฮต_j, the full causal order is identifiable from observational data when the noise terms ฮต_j are non-Gaussian. ICA-LiNGAM applies Independent Component Analysis to identify the causal ordering; DirectLiNGAM and VARLiNGAM extend this to time series. LiNGAM achieves full DAG identifiability โ€” not just the Markov equivalence class โ€” under the non-Gaussianity assumption.
  • NOTEARS (Zheng et al., 2018) reformulates the combinatorial DAG learning problem as a continuous optimisation problem by introducing a smooth, differentiable acyclicity constraint: h(W) = tr(e^{W โŠ™ W}) โˆ’ d = 0, where W is the weighted adjacency matrix and the constraint h(W) = 0 if and only if the graph is a DAG. This enables causal graph learning via gradient descent, scaling to hundreds of variables where constraint-based methods become computationally prohibitive. DAG-GNN and DYNOTEARS extend NOTEARS to nonlinear and time series settings.
  • The Markov equivalence class problem means that constraint-based methods like PC cannot uniquely identify a DAG from observational data โ€” they recover a CPDAG (Completed Partially Directed Acyclic Graph) that represents all DAGs consistent with the observed conditional independence relations. Only edges that have the same direction in all DAGs in the equivalence class are oriented. To resolve remaining orientation ambiguity, domain knowledge (temporal precedence, known intervention outcomes) or interventional data must be incorporated.
  • Practical causal discovery workflow: (1) Test for conditional independence using appropriate tests (Fisher Z-test for linear-Gaussian, kernel-based HSIC for nonlinear); (2) Run PC or FCI (which allows for latent confounders) for constraint-based discovery; (3) Validate the skeleton with domain experts โ€” the undirected graph is more reliable than the orientations; (4) Use LiNGAM or NOTEARS if linearity or non-Gaussianity assumptions are plausible; (5) Treat the discovered graph as a prior that refines causal inference analyses, not as ground truth. Python libraries: causal-learn (PC, FCI, LiNGAM), causalnex (NOTEARS + Bayesian network inference).

The most important question in data science is not “what predicts Y?” but “what causes Y, and what happens to Y if we intervene on X?” Answering the second question requires a causal graph โ€” a directed acyclic graph (DAG) encoding which variables directly causally influence which others. In most real-world settings, this graph is not known: researchers disagree, domain knowledge is incomplete, and the literature contains contradictory claims. Causal discovery algorithms address this problem directly: given a dataset of observational measurements, recover the causal graph (or the set of graphs consistent with the data) automatically. This guide covers the PC algorithm and constraint-based discovery, LiNGAM for fully identifiable linear discovery, NOTEARS and continuous optimisation-based methods, the FCI algorithm for settings with latent confounders, and the practical workflow for applying causal discovery to real tabular datasets using Python.

Constraint-Based Discovery โ€” PC and FCI Algorithms

Constraint-based causal discovery exploits the Causal Markov Condition: in the true causal DAG G, every variable is conditionally independent of its non-descendants given its direct parents. The PC algorithm recovers the causal graph by testing all conditional independence relationships implied by this condition and removing edges that are contradicted by the data. Phase 1 (skeleton learning): start with a complete undirected graph; for each pair of adjacent variables (X, Y), test whether they are conditionally independent given any subset S of their common neighbours, removing the edge Xโ€”Y if any separating set S is found and recording S as sep(X,Y). Phase 2 (orientation): orient edges by identifying v-structures X โ†’ Z โ† Y (where X and Y are not adjacent but both adjacent to Z, and Z โˆ‰ sep(X,Y)), then propagate orientations using Meek rules to avoid new v-structures or directed cycles. The connection to our causal inference guide is foundational: causal inference methods (do-calculus, backdoor adjustment, IV estimation) assume the causal graph is known; causal discovery provides the graph that those methods require. The connection to our hypothesis testing guide is direct: the conditional independence tests at the heart of PC (partial correlation tests for Gaussian data, kernel HSIC for nonlinear data) are statistical hypothesis tests with their own Type I and Type II error rates, and the PC algorithm’s reliability degrades as the number of tests grows with the number of variables.

FCI (Fast Causal Inference) extends PC to settings with latent common causes (unmeasured confounders). In the presence of latent variables, the observed marginal distribution may encode conditional dependencies that cannot be explained by direct causal links between observed variables โ€” instead, bidirected edges X โ†” Y in the PAG (Partial Ancestral Graph) represent latent common causes. FCI outputs a PAG rather than a CPDAG, representing all MAGs (Maximal Ancestral Graphs) consistent with the observed data. FCI is the appropriate algorithm for biomedical and social science datasets where unmeasured confounders are virtually guaranteed. The practical cost is that PAGs are harder to interpret and less actionable than DAGs: the presence of a bidirected edge X โ†” Y indicates a latent common cause but does not identify it, and many causal effect identification results require a DAG rather than a PAG.

AlgorithmOutputLatent Confounders?Nonlinear?Scales to
PCCPDAGNo (assumes causal sufficiency)Via kernel CI tests~50 variables
FCIPAGYesVia kernel CI tests~30 variables
LiNGAMFull DAGNoNo (linear)~500 variables
NOTEARSFull DAG (weighted)NoVia DAG-GNN~1000 variables
GESCPDAGNoVia non-parametric score~200 variables
DYNOTEARSFull DAG (time series)NoNo~100 time series

LiNGAM โ€” Full DAG Identifiability from Non-Gaussian Data

LiNGAM (Shimizu et al., 2006) achieves a remarkable result: in a linear structural equation model X = BX + ฮต where B is the adjacency matrix and the noise terms ฮต are mutually independent and non-Gaussian, the full DAG is uniquely identifiable from the observational distribution โ€” not just the Markov equivalence class. The key insight: Gaussian noise is the unique exception where the causal direction X โ†’ Y is statistically indistinguishable from Y โ†’ X. For any non-Gaussian noise distribution, the asymmetry between cause and effect is detectable via higher-order statistics (kurtosis, mutual information). ICA-LiNGAM applies ICA (Independent Component Analysis) to estimate the unmixing matrix W = Bโปยน, then recovers the causal order from the zero-pattern of W. DirectLiNGAM avoids ICA’s local optima by regressing each variable on the remaining variables and identifying the causal root (the variable whose residuals are independent of all other variables) iteratively. The connection to our linear algebra guide is direct: the B matrix factorisation and the ICA unmixing problem are fundamentally linear algebra problems involving permutation matrices and triangular decompositions. For time series causal discovery, VARLiNGAM combines a VAR (Vector AutoRegression) model with LiNGAM to identify both lagged (V_t-1 โ†’ V_t) and instantaneous (V_t โ†’ W_t) causal effects โ€” connecting to our time series analysis guide.

NOTEARS, Continuous Optimisation and Practical Workflow

NOTEARS (Zheng et al., 2018) transforms DAG learning into a smooth optimisation problem. The key contribution is the acyclicity characterisation: a real matrix W โˆˆ โ„^{dร—d} is the adjacency matrix of a DAG if and only if tr(e^{W โŠ™ W}) โˆ’ d = 0, where e^{W โŠ™ W} is the matrix exponential of the elementwise square. This constraint is differentiable everywhere, enabling the DAG learning problem to be solved as a penalised regression: min_W (1/2n)||X โˆ’ XW^T||ยฒ_F + ฮป||W||โ‚ subject to h(W) = 0, where ||W||โ‚ is an L1 sparsity penalty and h(W) = 0 enforces the DAG structure. The augmented Lagrangian method solves this efficiently, producing a sparse weighted adjacency matrix where W_ij โ‰  0 indicates a direct causal edge X_i โ†’ X_j. NOTEARS scales to hundreds of variables โ€” far beyond PC or FCI โ€” making it the practical choice for genomics (eQTL networks with hundreds of genes) and financial networks with many interacting variables. DAG-GNN (Yu et al., 2019) and GRAN-DAG replace the linear structural equation with a neural network, recovering nonlinear causal graphs at the cost of increased computational complexity and identifiability challenges. For a practical causal discovery session, causal-learn (Python) provides PC, FCI, and LiNGAM in a unified scikit-learn-style API, and causalnex provides NOTEARS with Bayesian network inference for the learned graph structure. The connection to our Bayesian statistics guide is direct: after running causal discovery to learn the graph skeleton, Bayesian network parameter learning (estimating conditional probability tables or conditional Gaussian parameters) combines the discovered structure with the data to enable probabilistic inference โ€” the full pipeline from graph learning to probabilistic prediction.

✦ SUMMARIZE THIS ARTICLE WITH AI

Causal inference (estimating effects given a known graph) is in our Causal Inference guide. Uplift modelling and CATE estimation that use causal graphs are in our Uplift Modelling guide. Bayesian statistics and Bayesian networks for parameter estimation on discovered graphs are in our Bayesian Statistics guide. Hypothesis testing for conditional independence tests (PC algorithm) is in our Hypothesis Testing guide. Time series causal discovery (VARLiNGAM, DYNOTEARS) connects to our Time Series Analysis guide. A/B testing as the gold-standard alternative (interventional data) is in our A/B Testing guide.

Leave feedback about this

  • Rating

Durgesh Kekare
Durgesh Kekarehttps://www.dataexpertise.in
Durgesh Kekare is a data science educator and founder of DataExpertise.in. With expertise in Python, machine learning, and analytics, he helps 10,000+ learners break into data careers.

Latest Posts

List of Categories