# PC算法

PC算法（Peter–Clark算法）是一种基于约束的因果发现方法，它通过对观测数据运行条件独立性统计检验，并将检验结果转化为图结构，从而学习因果有向无环图（DAG）的结构。该算法以其发明者彼得·斯皮尔特斯（Peter Spirtes）和克拉克·格利摩尔（Clark Glymour）命名，输出一个完成的部分有向无环图（CPDAG），即与数据一致的DAG的马尔可夫等价类。<sup>[1](https://journals.sagepub.com/doi/10.1177/09593543251325506)</sup><sup> • </sup><sup>[2](https://tetrad-manual.readthedocs.io/en/latest/algorithms/pc.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 起源 | 首次发表于斯皮尔特斯与格利摩尔的《一种快速恢复稀疏因果图的算法》（1991）；在现代形式下于《因果性、预测与搜索》（第二版，2000年）中正式化<sup>[3](https://journals.sagepub.com/doi/abs/10.1177/089443939100900106)</sup><sup> • </sup><sup>[2](https://tetrad-manual.readthedocs.io/en/latest/algorithms/pc.html)</sup> |
| 输出 | 在无环性、因果充分性以及因果马尔可夫条件与忠实性条件下，表示DAG马尔可夫等价类的CPDAG<sup>[2](https://tetrad-manual.readthedocs.io/en/latest/algorithms/pc.html)</sup> |
| 步骤 | 从完全无向图出发，利用条件独立性检验删除边（骨架阶段），定向无屏蔽碰撞器，然后以Meek规则传播定向<sup>[2](https://tetrad-manual.readthedocs.io/en/latest/algorithms/pc.html)</sup> |
| 高维保证 | 对于稀疏高斯DAG，当节点数随样本量以O(n<sup>a</sup>)的速度增长（对任意0 < a < ∞）时，具有一致相合性（Kalisch与Bühlmann，2007）<sup>[4](https://www.jmlr.org/beta/papers/v8/kalisch07a.html)</sup> |
| 复杂度 | 对稀疏图而言是变量数的多项式；最坏情况下CI检验次数关于图的最大度呈指数增长<sup>[5](https://pmc.ncbi.nlm.nih.gov/articles/PMC3254233/)</sup><sup> • </sup><sup>[6](https://arxiv.org/abs/2603.21844)</sup> |
| 主要弱点 | 假设因果充分性（无未测量的混杂因素）；一次错误的条件独立性检验就可能影响整个学习到的结构<sup>[1](https://journals.sagepub.com/doi/10.1177/09593543251325506)</sup> |
| 关键变体 | PC-stable（顺序无关的邻接搜索）、FCI（允许潜在混杂因素）、PCMCI（时间序列）<sup>[7](https://www.jmlr.org/beta/papers/v15/colombo14a.html)</sup><sup> • </sup><sup>[8](https://www.frontiersin.org/journals/genetics/articles/10.3389/fgene.2019.00524/full)</sup><sup> • </sup><sup>[9](https://www.nature.com/articles/s41467-026-69878-z_reference.pdf)</sup> |

## 算法工作原理

PC将因果发现视为一个约束满足问题，其约束是从数据中推断出的条件独立（CI）关系。算法分两个阶段进行。<sup>[10](https://www.annualreviews.org/content/journals/10.1146/annurev-statistics-031017-100053?crawler=true&mimetype=application%2Fpdf)</sup>

**骨架阶段。** 算法从所有变量上的全连接无向图开始。对于基数k = 0, 1, 2, …递增的条件集，每当找到一个大小为k的集合S——它是a或b的当前邻居的子集——使得X<sub>a</sub>与X<sub>b</sub>在给定X<sub>S</sub>时条件独立，就删除边X<sub>a</sub> − X<sub>b</sub>。搜索被限制在端点邻居的子集内，这使过程对稀疏图具有自适应性；过程持续到阶数q − 1，其中q是底层DAG的最大度。存活的边构成骨架，沿途找到的分离集被记录下来。<sup>[11](https://pmc.ncbi.nlm.nih.gov/articles/PMC8947566/)</sup>

**定向阶段。** 利用记录的分离集，算法定向无屏蔽碰撞器，即X → Y ← Z这样的三元组，其中X与Z不相邻且Y不在X与Z的分离集中。碰撞器留下链和叉所不具备的统计指纹，这正是仅凭观测数据就能确定部分边方向的原因。随后Meek规则将这些定向传播到剩余无向边上，同时不产生新的无屏蔽碰撞器或有向环，最终得到CPDAG。<sup>[2](https://tetrad-manual.readthedocs.io/en/latest/algorithms/pc.html)</sup><sup> • </sup><sup>[12](https://causal-ts.readthedocs.io/en/latest/examples/pc_step_by_step.html)</sup>

输出中通常有一些边保持无向，因为多个DAG可以蕴含同一组条件独立性；例如，X ⟂ Z | Y与链X → Y → Z、反向链以及叉X ← Y → Z都相容。<sup>[13](https://www.nbi.dk/~koskinen/Teaching/AdvancedMethodsInAppliedStatistics2023/StudentPresentations/harteg_causal_write_up.pdf)</sup><sup> • </sup><sup>[20](https://inst.eecs.berkeley.edu/~cs188/textbook/bayes-nets/d-separation.html)</sup>

## 假设

PC的正确性建立在一组强假设之上：因果马尔可夫假设（真实图中的d-分离蕴含分布中的条件独立）、忠实性（条件独立蕴含d-分离，因此不存在由因果效应偶然抵消而产生的独立性）、因果充分性（不存在未测量的共同原因）、无环性（无反馈回路）、无选择偏差，以及独立同分布样本。<sup>[1](https://journals.sagepub.com/doi/10.1177/09593543251325506)</sup><sup> • </sup><sup>[2](https://tetrad-manual.readthedocs.io/en/latest/algorithms/pc.html)</sup>

在这些假设下，如果在大样本极限下每个CI判断都正确，PC保证收敛到真实的马尔可夫等价类。<sup>[14](https://pmc.ncbi.nlm.nih.gov/articles/PMC6558187/)</sup> 在有限样本中，忠实性要求必须加强：由于CI关系是通过假设检验推断的，高斯情形需要强忠实性，即对边(i, j)的每个偏相关ρ<sub>ij|S</sub>，都以λ ≍ √(log(p)/n)为界远离零，以保证一致相合性。<sup>[10](https://www.annualreviews.org/content/journals/10.1146/annurev-statistics-031017-100053?crawler=true&mimetype=application%2Fpdf)</sup> 代数几何分析表明这一条件可能多么苛刻：在高维情形下，在非忠实区域填满参数空间之前，样本与变量的缩放比可能差到p<sub>n</sub> = O(log n)，这对依赖忠实性的算法（包括PC）是实实在在的限制。<sup>[10](https://www.annualreviews.org/content/journals/10.1146/annurev-statistics-031017-100053?crawler=true&mimetype=application%2Fpdf)</sup>

## 历史

斯皮尔特斯与格利摩尔1991年的论文提出了关键洞见：条件独立性信息连同稀疏性，可以高效地修剪全连接图，这是一种渐近正确的算法，对固定图连通性其复杂度随顶点数多项式增长。在最初的演示中，从n = 20,000的样本数据出发，在DECStation 3100上的一个实现于10秒内恢复了具有37个顶点和46条边的ALARM网络线性版本的边，无向边误判率低于8%，在没有先验顺序信息的情况下以14%的错误率确定了边方向。<sup>[3](https://journals.sagepub.com/doi/abs/10.1177/089443939100900106)</sup><sup> • </sup><sup>[2](https://tetrad-manual.readthedocs.io/en/latest/algorithms/pc.html)</sup>

更早的算法如SGS（斯皮尔特斯、格利摩尔和Scheines）以及Verma和Pearl的IC算法，只能用于变量很少的数据集，因为它们需要对变量的所有可能子集进行条件化；PC的邻居限制搜索才使稀疏的较大问题变得可处理。<sup>[15](https://bayes.cs.ucla.edu/TRIBUTE/festschrift-complete.pdf)</sup> PC成为基于约束的基础方法，FCI、RFCI、GFCI、PC-Max和CCD是其直接的概念后裔。<sup>[2](https://tetrad-manual.readthedocs.io/en/latest/algorithms/pc.html)</sup>

## 高维性能

Kalisch和Bühlmann（2007）证明了PC算法对极高维稀疏高斯DAG的一致相合性，允许节点数随样本量n以O(n<sup>a</sup>)的速度增长（对任意0 < a < ∞），稀疏性假设仅要求DAG中邻域大小的增长阶低于n。他们还发现该算法对其单一调优参数——CI检验的显著性水平α——的选择相当不敏感。<sup>[4](https://www.jmlr.org/beta/papers/v8/kalisch07a.html)</sup> 对于最大邻域大小q较小的稀疏图，一种高效实现的复杂度以高概率被O(p<sup>q</sup>)所界，其中p是变量数，不过在基因调控网络等领域，枢纽节点可能使q很大、计算昂贵。<sup>[5](https://pmc.ncbi.nlm.nih.gov/articles/PMC3254233/)</sup> 在最坏情况下，PC执行的CI检验次数关于图的最大度呈指数增长。<sup>[6](https://arxiv.org/abs/2603.21844)</sup>

## 变体与扩展

**PC-stable。** 原始PC算法依赖顺序：其输出可能取决于变量的给定顺序，这在低维是小问题，但在高维设置中会产生高度可变的结果。PC-stable修改在每个条件集基数k之后计算并存储所有变量的邻接集，使得删除一条边不再影响该规模下对其他变量对检查哪些CI关系。Colombo和Maathuis表明这些修改在与原始算法相同的条件下是一致的，在低维表现相似，在高维改善性能；软件在R包pcalg中实现。<sup>[7](https://www.jmlr.org/beta/papers/v15/colombo14a.html)</sup><sup> • </sup><sup>[11](https://pmc.ncbi.nlm.nih.gov/articles/PMC8947566/)</sup>

**FCI。** 快速因果推断算法放宽了因果充分性，容忍并有时发现未知混杂变量，返回一个部分祖先图（PAG），其圆圈端点标记出无法排除隐藏共同原因的位置。即使在存在混杂因素的情况下，其结果也是渐近正确的，代价是更大的边标记模糊性。FCI将PC邻接搜索作为第一步复用，因此对PC的改进会延续到FCI。<sup>[8](https://www.frontiersin.org/journals/genetics/articles/10.3389/fgene.2019.00524/full)</sup><sup> • </sup><sup>[11](https://pmc.ncbi.nlm.nih.gov/articles/PMC8947566/)</sup><sup> • </sup><sup>[16](https://github.com/benovamurat/causal-discovery-pc/blob/main/README.md)</sup>

**其他改编。** PCMCI通过首先应用PC算法识别可能的同期联系，然后对更早时间步运行瞬时条件独立性检验，将PC适配于时间序列。<sup>[9](https://www.nature.com/articles/s41467-026-69878-z_reference.pdf)</sup> CI检验的选择是一个自由参数：实现通常为连续高斯数据提供Fisher's Z，为离散数据提供卡方和G平方检验，为非线性设置提供基于核的检验，以及Fisher's Z的缺失值变体。<sup>[17](https://causal-learn.readthedocs.io/en/latest/search_methods_index/Constraint-based%20causal%20discovery%20methods/PC.html)</sup>

## 实践与局限

PC及其变体已被证明对高维数据有效，并能容纳连续和离散变量。其统计功效取决于样本量、变量的数量和类型、CI检验中使用的α水平以及边强度；随着CI检验次数增加，统计功效下降。<sup>[18](https://pmc.ncbi.nlm.nih.gov/articles/PMC12904928/)</sup> CI检验也随着条件集增大而失去功效，当每个变量的观测少于约10到20个时，输出最好被视为假设生成性的，并通过自助重采样和领域审查加以验证。<sup>[16](https://github.com/benovamurat/causal-discovery-pc/blob/main/README.md)</sup>

因果充分性假设是许多应用领域中最重大的局限。例如在心理学研究中，控制所有潜在混杂因素往往具有挑战性，这就是FCI在那里常被认为更适用的原因；FCI还可以推广到循环因果关系。<sup>[18](https://pmc.ncbi.nlm.nih.gov/articles/PMC12904928/)</sup> 一次错误的CI检验可能传播到整个结构，且算法对噪声和数据集中的变量顺序敏感，后者由PC-stable解决。<sup>[18](https://pmc.ncbi.nlm.nih.gov/articles/PMC12904928/)</sup> 与贪心等价搜索（GES）等基于分数的方法相比，PC提供了透明的审计轨迹，因为每次边的删除或保留都对应一个特定的统计检验，这在领域专家需要检查每条边的依据时很有用；在大样本极限下，两种方法在几乎相同的假设下收敛到相同的马尔可夫等价类。<sup>[19](https://inferensys.com/differences/neuro-symbolic-ai-frameworks/causal-reasoning-frameworks/pc-algorithm-vs-ges-causal-discovery-methods)</sup><sup> • </sup><sup>[8](https://www.frontiersin.org/journals/genetics/articles/10.3389/fgene.2019.00524/full)</sup>

应用包括推断表型之间的因果关系、估计基因调控网络，以及对拟南芥（*Arabidopsis thaliana*）中的基因网络建模，PC仍然是新的因果发现算法与之比较的标准基线。<sup>[14](https://pmc.ncbi.nlm.nih.gov/articles/PMC6558187/)</sup><sup> • </sup><sup>[2](https://tetrad-manual.readthedocs.io/en/latest/algorithms/pc.html)</sup>

## References

1. [Waldorp, Schutzeichel & de Jong (2025). Causal inference: Principles unifying experimental and observational accounts. Theory & Psychology.](https://journals.sagepub.com/doi/10.1177/09593543251325506)
2. [PC — Peter–Clark Algorithm, Tetrad Manual](https://tetrad-manual.readthedocs.io/en/latest/algorithms/pc.html)
3. [Spirtes, P. & Glymour, C. (1991). An Algorithm for Fast Recovery of Sparse Causal Graphs. Social Science Computer Review 9(1).](https://journals.sagepub.com/doi/abs/10.1177/089443939100900106)
4. [Kalisch, M. & Bühlmann, P. (2007). Estimating High-Dimensional Directed Acyclic Graphs with the PC-Algorithm. JMLR 8, 613–636.](https://www.jmlr.org/beta/papers/v8/kalisch07a.html)
5. [Penalized likelihood methods for estimation of sparse high-dimensional directed acyclic graphs. PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC3254233/)
6. [Franquesa Monés, Zhang & Uhler. On the Number of Conditional Independence Tests in Constraint-based Causal Discovery. arXiv:2603.21844.](https://arxiv.org/abs/2603.21844)
7. [Colombo, D. & Maathuis, M. H. (2014). Order-Independent Constraint-Based Causal Structure Learning. JMLR 15, 3921–3962.](https://www.jmlr.org/beta/papers/v15/colombo14a.html)
8. [Review of Causal Discovery Methods Based on Graphical Models. Frontiers in Genetics (2019).](https://www.frontiersin.org/journals/genetics/articles/10.3389/fgene.2019.00524/full)
9. [Descriptions of algorithms for causal discovery, Nature Communications reference table.](https://www.nature.com/articles/s41467-026-69878-z_reference.pdf)
10. [Casanellas, Petrović & Uhler. Causal Structure Discovery Algorithms and Faithfulness. Annual Review of Statistics and Its Application.](https://www.annualreviews.org/content/journals/10.1146/annurev-statistics-031017-100053?crawler=true&mimetype=application%2Fpdf)
11. [Nonparametric Causal Structure Learning in High Dimensions. PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC8947566/)
12. [How the PC Algorithm Works — Step by Step, Causal-TS documentation.](https://causal-ts.readthedocs.io/en/latest/examples/pc_step_by_step.html)
13. [Causal Discovery, Advanced Methods in Applied Statistics course notes, Niels Bohr Institute.](https://www.nbi.dk/~koskinen/Teaching/AdvancedMethodsInAppliedStatistics2023/StudentPresentations/harteg_causal_write_up.pdf)
14. [Review of Causal Discovery Methods Based on Graphical Models. PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC6558187/)
15. [Festschrift for Jude Pearl: Model Search Assuming Causal Sufficiency. UCLA.](https://bayes.cs.ucla.edu/TRIBUTE/festschrift-complete.pdf)
16. [causal-discovery-pc README, GitHub.](https://github.com/benovamurat/causal-discovery-pc/blob/main/README.md)
17. [PC — causal-learn documentation.](https://causal-learn.readthedocs.io/en/latest/search_methods_index/Constraint-based%20causal%20discovery%20methods/PC.html)
18. [Causal discovery methods in psychological research: Foundations, algorithms, and a practical tutorial in R. Behavior Research Methods / PMC.](https://pmc.ncbi.nlm.nih.gov/articles/PMC12904928/)
19. [PC Algorithm vs GES: Causal Discovery Methods Compared, Inference Systems.](https://inferensys.com/differences/neuro-symbolic-ai-frameworks/causal-reasoning-frameworks/pc-algorithm-vs-ges-causal-discovery-methods)
20. [6.5 D-Separation](https://inst.eecs.berkeley.edu/~cs188/textbook/bayes-nets/d-separation.html)

---
*Initially written Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Applied, official, and domain statistics › Causal inference (applied methodology) › Causal discovery and learning

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/pc-algorithm

English original: https://www.edgepedia.org/pc-algorithm
