math-skill 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +278 -0
- package/agents/math-critic.md +203 -0
- package/commands/abstraction.md +34 -0
- package/commands/algorithmic-thinking.md +34 -0
- package/commands/ask.md +21 -0
- package/commands/axiomatization.md +34 -0
- package/commands/causal-inference.md +34 -0
- package/commands/discrete-combinatorial.md +34 -0
- package/commands/game-theory.md +34 -0
- package/commands/induction-analogy.md +34 -0
- package/commands/information-theory.md +34 -0
- package/commands/logic-deduction.md +34 -0
- package/commands/modeling.md +37 -0
- package/commands/optimization.md +33 -0
- package/commands/probability-statistics.md +36 -0
- package/commands/symmetry-invariance.md +34 -0
- package/commands/topological-thinking.md +33 -0
- package/commands/transformation.md +33 -0
- package/docs/CLAUDE.md +187 -0
- package/docs/inspiration.md +113 -0
- package/knowledge-base/overview.md +230 -0
- package/package.json +60 -0
- package/skills/abstraction/SKILL.md +264 -0
- package/skills/abstraction/original-texts.md +175 -0
- package/skills/algorithmic-thinking/SKILL.md +371 -0
- package/skills/algorithmic-thinking/original-texts.md +256 -0
- package/skills/axiomatization/SKILL.md +213 -0
- package/skills/axiomatization/original-texts.md +160 -0
- package/skills/causal-inference/SKILL.md +374 -0
- package/skills/causal-inference/original-texts.md +167 -0
- package/skills/discrete-combinatorial/SKILL.md +286 -0
- package/skills/discrete-combinatorial/original-texts.md +185 -0
- package/skills/game-theory/SKILL.md +318 -0
- package/skills/game-theory/original-texts.md +131 -0
- package/skills/induction-analogy/SKILL.md +310 -0
- package/skills/induction-analogy/original-texts.md +154 -0
- package/skills/information-theory/SKILL.md +242 -0
- package/skills/information-theory/original-texts.md +127 -0
- package/skills/logic-deduction/SKILL.md +280 -0
- package/skills/logic-deduction/original-texts.md +173 -0
- package/skills/meta-selector/SKILL.md +188 -0
- package/skills/meta-selector/original-texts.md +105 -0
- package/skills/modeling/SKILL.md +318 -0
- package/skills/modeling/original-texts.md +165 -0
- package/skills/optimization/SKILL.md +292 -0
- package/skills/optimization/original-texts.md +168 -0
- package/skills/probability-statistics/SKILL.md +312 -0
- package/skills/probability-statistics/original-texts.md +193 -0
- package/skills/symmetry-invariance/SKILL.md +358 -0
- package/skills/symmetry-invariance/original-texts.md +221 -0
- package/skills/topological-thinking/SKILL.md +273 -0
- package/skills/topological-thinking/original-texts.md +164 -0
- package/skills/transformation/SKILL.md +264 -0
- package/skills/transformation/original-texts.md +216 -0
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: causal-inference
|
|
3
|
+
description: |
|
|
4
|
+
科研模式触发:干预效果评估、政策评估、DAG建模、do-calculus、反事实推理的数学形式化。
|
|
5
|
+
生活模式触发:区分原因与借口、反事实思考、评估某事是否真的有效、判断"做了X会怎样"而非"看到X时如何"。
|
|
6
|
+
English Research Mode: intervention effect evaluation, policy evaluation, DAG modeling, do-calculus, counterfactual reasoning formalization.
|
|
7
|
+
English Life Mode: distinguishing cause from excuse, counterfactual thinking, evaluating whether something truly works, judging "what if we did X" not "how is Y when we see X".
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# 🔗 因果推断思想
|
|
11
|
+
|
|
12
|
+
> "相关不等于因果——但因果可以理清。关键区别:'看到X时Y如何'≠'如果做了X会怎样'"
|
|
13
|
+
> "Correlation is not causation — but causation can be sorted out. Key distinction: 'how is Y when we see X' ≠ 'what if we did X'"
|
|
14
|
+
>
|
|
15
|
+
> —— 因果推断、结构因果模型、反事实推理
|
|
16
|
+
> —— Causal Inference, Structural Causal Models, Counterfactual Reasoning
|
|
17
|
+
|
|
18
|
+
## 核心原则 / Core Principle
|
|
19
|
+
|
|
20
|
+
**因果推断回答的问题超出了概率论的表达能力:概率论能回答"看到 X 时 Y 如何",但不能回答"如果做了 X 会怎样"。Pearl 的因果层级(Ladder of Causation)将推理能力分为三层,每层需要更强的建模假设。**
|
|
21
|
+
|
|
22
|
+
**Causal inference answers questions beyond the expressive power of probability theory: probability can answer "how is Y when we see X," but not "what if we did X." Pearl's Ladder of Causation divides reasoning into three levels, each requiring stronger modeling assumptions.**
|
|
23
|
+
|
|
24
|
+
> **数学形式化 / Mathematical Formalization**(科研模式参考)
|
|
25
|
+
>
|
|
26
|
+
> Pearl 因果层级 / Pearl's Causal Hierarchy:
|
|
27
|
+
>
|
|
28
|
+
> - **Level 1 关联 / Association**:P(y|x) —— 看到/观察 / Seeing/Observing
|
|
29
|
+
> - 问题:"观察到 X 时 Y 是什么?"——纯粹统计关联,条件概率即可回答
|
|
30
|
+
> - 例:"购买牙膏的人更可能购买牙线"——P(牙线|牙膏) > P(牙线)
|
|
31
|
+
>
|
|
32
|
+
> - **Level 2 干预 / Intervention**:P(y|do(x)) —— 做/干预 / Doing/Intervening
|
|
33
|
+
> - 问题:"如果我强制设定 X,Y 会怎样?"——需要因果模型,do-演算回答
|
|
34
|
+
> - 例:"如果提高价格,销量会怎样?"——P(销量|do(价格↑)) ≠ P(销量|价格↑)
|
|
35
|
+
>
|
|
36
|
+
> - **Level 3 反事实 / Counterfactual**:P(y_x|x',y') —— 想/回顾 / Imagining/Retrospective
|
|
37
|
+
> - 问题:"如果当时 X 是 x₁ 而不是 x₀,Y 会怎样?"——需要结构因果模型
|
|
38
|
+
> - 例:"如果患者当时没服药,他是否还能康复?"——个体层面推理
|
|
39
|
+
>
|
|
40
|
+
> **do(x) 干预不同于条件化 x**:
|
|
41
|
+
>
|
|
42
|
+
> P(y|do(x)) = Σ_z P(y|x,z)P(z) (后门调整公式 / back-door adjustment)
|
|
43
|
+
>
|
|
44
|
+
> - 条件化 P(y|x):在观察到 X=x 的人群中 Y 的分布——受混淆变量影响
|
|
45
|
+
> - 干预 P(y|do(x)):在强制设定 X=x 的人群中 Y 的分布——切断了所有指向 X 的因果箭头
|
|
46
|
+
>
|
|
47
|
+
> **do-演算三条规则 / Do-calculus Three Rules**:
|
|
48
|
+
>
|
|
49
|
+
> - 规则 1(插入/删除观察):若 Y ⊥ Z | X 在删去所有指向 X 的箭头后的图中成立,则 P(y|do(x),z) = P(y|do(x))
|
|
50
|
+
> - 规则 2(干预与观察互换):若 Y ⊥ Z | X 在删去所有指向 X 的箭头并删去所有从 Z 出发的箭头后的图中成立,则 P(y|do(x),do(z)) = P(y|do(x),z)
|
|
51
|
+
> - 规则 3(插入/删除干预):若 Y ⊥ Z | X 在删去所有指向 X 的箭头并删去所有从 Z 到 X 的路径上的箭头后的图中成立,则 P(y|do(x),do(z)) = P(y|do(x))
|
|
52
|
+
>
|
|
53
|
+
> **因果推理需要显式因果模型,不能仅靠数据推导。DAG 编码因果假设,do-演算将干预表达式转化为可观测量。**
|
|
54
|
+
>
|
|
55
|
+
> 详细数学依据见 `original-texts.md`
|
|
56
|
+
|
|
57
|
+
## 不适用场景 / When NOT to Use
|
|
58
|
+
|
|
59
|
+
- **纯粹的预测任务且无因果问题** `[科研/通用]`(只需要预测 P(y|x),不关心"为什么")——关联足够,因果是多余的
|
|
60
|
+
**Purely predictive tasks with no causal question** (only need P(y|x), don't care "why") — association suffices, causation is superfluous
|
|
61
|
+
|
|
62
|
+
- **无可编码的因果假设** `[科研/通用]`(无法画出合理的 DAG,因果方向不确定)——因果推断依赖显式假设,没有假设就没有因果结论
|
|
63
|
+
**No causal assumptions available to encode** (cannot draw a reasonable DAG, causal direction uncertain) — causal inference requires explicit assumptions; without assumptions there are no causal conclusions
|
|
64
|
+
|
|
65
|
+
- **确定性系统且无变异** `[科研]`(每个输入严格对应唯一输出,无随机性)——因果已被确定性机制完全描述,无需概率因果框架
|
|
66
|
+
**Deterministic system with no variation** (each input strictly maps to a unique output, no randomness) — causation is fully described by the deterministic mechanism, no probabilistic causal framework needed
|
|
67
|
+
|
|
68
|
+
- **只需要解释现象而非追问"如果做了X"** `[生活]`(日常生活中只需理解"为什么发生",不需要精确量化干预效果)——常识推理足够,不必引入形式化框架
|
|
69
|
+
**Only need to explain phenomena, not ask "what if we did X"** (daily life only needs to understand "why it happened," no need to precisely quantify intervention effects) — common-sense reasoning suffices, no need for formalized frameworks
|
|
70
|
+
|
|
71
|
+
## 何时使用 / When to Use
|
|
72
|
+
|
|
73
|
+
### 科研触发条件 / Research Trigger Conditions
|
|
74
|
+
|
|
75
|
+
- 需要知道干预的效果("如果做了 X,Y 会怎样?")——需要 P(y|do(x)) 而非 P(y|x)
|
|
76
|
+
Need to know the effect of an intervention ("what if we did X?") — need P(y|do(x)) not P(y|x)
|
|
77
|
+
|
|
78
|
+
- 需要区分原因与混淆变量(X 是 Y 的原因,还是 Z 同时导致了 X 和 Y?)——DAG 帮助识别混淆路径
|
|
79
|
+
Need to distinguish cause from confounder (is X a cause of Y, or does Z cause both X and Y?) — DAG helps identify confounding paths
|
|
80
|
+
|
|
81
|
+
- 需要反事实推理("如果当时没有做 A,结果会怎样?")——Level 3 推理需要结构方程
|
|
82
|
+
Need counterfactual reasoning ("what if A had not been done, what would the result be?") — Level 3 reasoning requires structural equations
|
|
83
|
+
|
|
84
|
+
- 需要政策评估(某政策是否真的有效?还是混淆变量制造了虚假效果?)——后门调整消除混淆偏差
|
|
85
|
+
Need policy evaluation (is a policy truly effective, or is a confounder creating a spurious effect?) — back-door adjustment removes confounding bias
|
|
86
|
+
|
|
87
|
+
- 需要识别中介变量(X 通过 M 影响 Y,还是 X 直接影响 Y?)——中介分析拆分直接与间接效应
|
|
88
|
+
Need to identify mediators (does X affect Y through M, or directly?) — mediation analysis decomposes direct and indirect effects
|
|
89
|
+
|
|
90
|
+
- 需要设计实验来验证因果机制(如何构造 RCT 或自然实验来测试因果假设?)——实验设计直接阻断混淆路径
|
|
91
|
+
Need to design experiments targeting causal mechanisms (how to construct an RCT or natural experiment to test causal hypotheses?) — experimental design directly blocks confounding paths
|
|
92
|
+
|
|
93
|
+
### 生活触发条件 / Life Trigger Conditions
|
|
94
|
+
|
|
95
|
+
- 需要区分原因与借口("他迟到是因为堵车"是真原因还是借口?——真原因可以通过干预验证,借口只是事后解释)
|
|
96
|
+
Need to distinguish cause from excuse ("he was late because of traffic" — is that a real cause or just an excuse?) — real causes can be verified through intervention, excuses are just post-hoc explanations
|
|
97
|
+
|
|
98
|
+
- 需要反事实思考("如果当初选了另一条路会怎样?"——帮助理解当下选择的真实影响)
|
|
99
|
+
Need counterfactual thinking ("what if I had chosen another path?") — helps understand the real impact of current choices
|
|
100
|
+
|
|
101
|
+
- 需要评估某事是否真的有效("早起就能成功?"还是"成功人士恰好早起?"——区分"做了X的效果"和"看到X时的关联")
|
|
102
|
+
Need to evaluate whether something truly works ("does waking up early lead to success?" or "do successful people just happen to wake up early?") — distinguish "the effect of doing X" from "the association when seeing X"
|
|
103
|
+
|
|
104
|
+
- 需要判断"如果做了X会怎样"而非"看到X时如何"("看到健身的人更健康"≠"健身就能健康"——可能有隐藏的共同原因)
|
|
105
|
+
Need to judge "what if we did X" not "how things are when we see X" ("seeing gym-goers healthier" ≠ "going to the gym makes you healthy") — there may be hidden common causes
|
|
106
|
+
|
|
107
|
+
- 需要避免把相关当因果("喝咖啡的人更健康"可能不是咖啡的功劳——而是喝咖啡的人本身更注重健康习惯)
|
|
108
|
+
Need to avoid mistaking correlation for causation ("coffee drinkers are healthier" may not be thanks to coffee — rather, coffee drinkers tend to have healthier habits)
|
|
109
|
+
|
|
110
|
+
## 方法流程 / Method
|
|
111
|
+
|
|
112
|
+
### 第一步:构建因果 DAG / Construct the Causal DAG
|
|
113
|
+
|
|
114
|
+
#### 科研模式 / Research Mode
|
|
115
|
+
|
|
116
|
+
明确问题中的所有变量,画出因果箭头,编码关于直接原因的假设,检查是否有循环(DAG 必须是无环的)。
|
|
117
|
+
|
|
118
|
+
- **识别变量**:原因变量 X(干预对象)、结果变量 Y(关注效应)、混淆变量 Z(同时影响 X 和 Y)、中介变量 M(X→M→Y)
|
|
119
|
+
- **画因果箭头**:每个箭头 X→Y 表示"X 是 Y 的直接原因"——箭头方向编码因果假设
|
|
120
|
+
- **检查无环性**:DAG 是有向无环图——若存在环路,则因果方向不确定,需要重新建模
|
|
121
|
+
|
|
122
|
+
**关键问题**:你是否有足够的领域知识来编码因果方向?因果推断的结论完全依赖 DAG 的正确性。
|
|
123
|
+
|
|
124
|
+
#### 生活模式 / Life Mode
|
|
125
|
+
|
|
126
|
+
画出因果链——用箭头表示"导致"而非"伴随"。问自己:X真的导致Y,还是它们只是恰好同时出现?有没有隐藏的共同原因同时影响了X和Y?
|
|
127
|
+
|
|
128
|
+
Draw causal chains — use arrows to mean "causes" not "co-occurs." Ask yourself: does X truly cause Y, or do they just happen to appear together? Is there a hidden common cause that influences both X and Y?
|
|
129
|
+
|
|
130
|
+
- 不要把"同时出现"当成"导致"——两个现象经常一起出现,不代表一个导致了另一个
|
|
131
|
+
- 用简单箭头图理清因果:A→B→C 表示"A导致B,B导致C"
|
|
132
|
+
- 检查有没有"隐藏的第三因素"同时指向A和B
|
|
133
|
+
|
|
134
|
+
#### 共通要点 / Shared Essentials
|
|
135
|
+
|
|
136
|
+
因果假设必须显式声明——无论是形式化 DAG 还是简单因果链,都需要明确"谁导致谁"的假设依据。
|
|
137
|
+
|
|
138
|
+
Causal assumptions must be explicitly stated — whether formal DAGs or simple causal chains, the basis for "who causes whom" must be made clear.
|
|
139
|
+
|
|
140
|
+
### 第二步:识别混淆变量 / Identify Confounders
|
|
141
|
+
|
|
142
|
+
#### 科研模式 / Research Mode
|
|
143
|
+
|
|
144
|
+
混淆变量同时影响原因 X 和结果 Y,创造虚假的关联——不调整混淆则效应估计有偏。
|
|
145
|
+
|
|
146
|
+
- **定义**:变量 Z 是混淆变量,若 Z 是 X 和 Y 的共同原因(DAG 中 Z→X 且 Z→Y)
|
|
147
|
+
- **DAG 识别法**:找出 X 和 Y 的所有共同祖先——这些就是潜在的混淆变量
|
|
148
|
+
- **后门路径**:X ← Z → Y 是后门路径——它创造的非因果关联需要被阻断
|
|
149
|
+
|
|
150
|
+
**关键问题**:所有混淆变量是否都可观测?若存在未观测混淆,后门调整不可用,需考虑前门准则或工具变量。
|
|
151
|
+
|
|
152
|
+
#### 生活模式 / Life Mode
|
|
153
|
+
|
|
154
|
+
有没有一个隐藏因素同时影响了"原因"和"结果"?——比如"喝咖啡的人更健康"可能是因为喝咖啡的人本身更注重健康习惯,而不是咖啡让人健康
|
|
155
|
+
|
|
156
|
+
Is there a hidden factor that influences both the "cause" and the "outcome"? — e.g., "coffee drinkers are healthier" might be because coffee drinkers tend to have healthier habits, not because coffee makes you healthy
|
|
157
|
+
|
|
158
|
+
- 检查:有没有一个你没考虑到的因素,同时影响了两边?
|
|
159
|
+
- 常见混淆:健康习惯与健康结果、教育与收入、年龄与多种结果
|
|
160
|
+
- 混淆的特征:它同时出现在"原因"和"结果"的上游
|
|
161
|
+
|
|
162
|
+
#### 共通要点 / Shared Essentials
|
|
163
|
+
|
|
164
|
+
混淆变量的本质是创造虚假关联——不管形式化与否,识别"同时影响X和Y的因素"是因果推理的核心步骤。
|
|
165
|
+
|
|
166
|
+
The essence of confounders is creating spurious associations — whether formalized or not, identifying "factors that simultaneously influence X and Y" is the core step of causal reasoning.
|
|
167
|
+
|
|
168
|
+
### 第三步:选择识别策略 / Choose Identification Strategy
|
|
169
|
+
|
|
170
|
+
#### 科研模式 / Research Mode
|
|
171
|
+
|
|
172
|
+
根据混淆变量的可观测性,选择从观测数据计算 P(y|do(x)) 的策略:
|
|
173
|
+
|
|
174
|
+
**后门准则 / Back-door Criterion**:
|
|
175
|
+
若存在变量集 S 使得 (1) S 阻断 X→Y 的所有后门路径,(2) S 不包含 X 的后代,则:
|
|
176
|
+
P(y|do(x)) = Σ_s P(y|x,S=s)·P(S=s)
|
|
177
|
+
|
|
178
|
+
**前门准则 / Front-door Criterion**:
|
|
179
|
+
若混淆变量不可观测但中介变量 M 可观测,且 (1) X→M 且 X 到 M 无后门路径,(2) M→Y 且 X 到 Y 的所有后门路径都被 M 阻断,则:
|
|
180
|
+
P(y|do(x)) = Σ_m P(y|do(m))·P(m|do(x)) = Σ_m Σ_z P(y|m,z)·P(z)·P(m|x)
|
|
181
|
+
|
|
182
|
+
**do-演算 / Do-calculus**:
|
|
183
|
+
三条规则允许在可观测量间转换 do-表达式(详见核心原则中的数学形式化块)
|
|
184
|
+
|
|
185
|
+
#### 生活模式 / Life Mode
|
|
186
|
+
|
|
187
|
+
如何排除混淆因素的干扰?——能不能找到一个"纯净"的比较组(只差别在X上,其他条件完全一样)?
|
|
188
|
+
|
|
189
|
+
How to eliminate the influence of confounding factors? — can we find a "clean" comparison group (different only in X, identical in all other conditions)?
|
|
190
|
+
|
|
191
|
+
- 最理想的比较:两组人除了"是否做了X"之外完全一样——如果结果不同,才能说X导致了差异
|
|
192
|
+
- 如果找不到"纯净"比较组,至少尽量控制已知混淆因素——让比较更公平
|
|
193
|
+
- 注意:观察性数据总有遗漏混淆的风险,真正的因果验证需要实验
|
|
194
|
+
|
|
195
|
+
#### 共通要点 / Shared Essentials
|
|
196
|
+
|
|
197
|
+
识别策略的本质是"如何从混杂的数据中提取纯净的因果信号"——形式化工具和常识策略都在解决同一个问题。
|
|
198
|
+
|
|
199
|
+
The essence of identification strategy is "how to extract a clean causal signal from mixed data" — formal tools and common-sense strategies both solve the same problem.
|
|
200
|
+
|
|
201
|
+
### 第四步:计算干预效果 / Compute Intervention Effects
|
|
202
|
+
|
|
203
|
+
#### 科研模式 / Research Mode
|
|
204
|
+
|
|
205
|
+
使用调整公式计算 P(y|do(x)),并与观察性 P(y|x) 对比以衡量混淆偏差。
|
|
206
|
+
|
|
207
|
+
- **后门调整**:P(y|do(x)) = Σ_z P(y|x,z)·P(z)——对混淆变量 Z 的所有取值加权平均
|
|
208
|
+
- **混淆偏差度量**:|P(y|do(x)) - P(y|x)|——偏差越大,说明混淆越严重
|
|
209
|
+
- **因果效应**:ATE = E[Y|do(X=1)] - E[Y|do(X=0)]——平均处理效应
|
|
210
|
+
|
|
211
|
+
**关键问题**:P(y|do(x)) 与 P(y|x) 是否显著不同?若不同,说明观察性分析有混淆偏差;若相同,说明没有显著混淆(但可能是巧合)。
|
|
212
|
+
|
|
213
|
+
#### 生活模式 / Life Mode
|
|
214
|
+
|
|
215
|
+
如果我真的做了X(而不是刚好看到X),结果会怎样?——"看到成功人士早起"≠"早起就能成功"
|
|
216
|
+
|
|
217
|
+
What would happen if I actually did X (rather than just seeing X)? — "seeing successful people wake up early" ≠ "waking up early leads to success"
|
|
218
|
+
|
|
219
|
+
- 区分两种问题:"看到X的人Y如何?"和"做了X之后Y如何?"
|
|
220
|
+
- 第一个问题只是观察——可能有混淆;第二个才是因果——需要排除混淆
|
|
221
|
+
- 实际判断时:问"如果我主动做了X,结果和只是看到别人做X时一样吗?"
|
|
222
|
+
|
|
223
|
+
#### 共通要点 / Shared Essentials
|
|
224
|
+
|
|
225
|
+
干预效果的核心是"做了"与"看到"的区别——无论是 P(y|do(x)) 还是日常直觉,都要区分主动干预与被动观察。
|
|
226
|
+
|
|
227
|
+
The core of intervention effects is the distinction between "doing" and "seeing" — whether P(y|do(x)) or daily intuition, we must separate active intervention from passive observation.
|
|
228
|
+
|
|
229
|
+
### 第五步:反事实分析 / Counterfactual Analysis
|
|
230
|
+
|
|
231
|
+
#### 科研模式 / Research Mode
|
|
232
|
+
|
|
233
|
+
对个体层面进行回顾性推理:如果 X 是 x₁ 而不是 x₀,Y 会怎样?
|
|
234
|
+
|
|
235
|
+
- **结构因果模型 / SCM**:Y = f(X, Z, U),其中 U 为外生变量(不可观测的个体特征)
|
|
236
|
+
- **反事实计算**:给定观测值 (X=x₀, Y=y₀, Z=z₀),反事实 Y_{x₁} = f(x₁, z₀, u₀)
|
|
237
|
+
- **个体因果效应**:Y_{x₁} - Y_{x₀}——个体层面的因果效应,需要结构方程
|
|
238
|
+
|
|
239
|
+
**关键问题**:你有足够的信息来区分个体差异吗?反事实推理依赖结构方程的具体形式,对模型假设极为敏感。
|
|
240
|
+
|
|
241
|
+
#### 生活模式 / Life Mode
|
|
242
|
+
|
|
243
|
+
如果当初选了另一条路,现在会怎样?——反事实思考帮助理解因果关系,但要注意:我们永远无法真正验证"如果当初怎样"
|
|
244
|
+
|
|
245
|
+
What if I had chosen a different path? — counterfactual thinking helps understand causation, but note: we can never truly verify "what if things had been different"
|
|
246
|
+
|
|
247
|
+
- 反事实思考的价值:帮助理解"什么导致了什么"——如果去掉X,Y还会发生吗?
|
|
248
|
+
- 反事实思考的局限:我们永远无法回到过去验证——只能基于现有信息推断
|
|
249
|
+
- 避免过度依赖反事实:它帮助理解因果,但不能作为确定性的证据
|
|
250
|
+
|
|
251
|
+
#### 共通要点 / Shared Essentials
|
|
252
|
+
|
|
253
|
+
反事实推理是因果理解的最深层——它追问"如果不是这样,会怎样",无论是形式化 SCM 还是日常反思,都需要承认其不可验证性。
|
|
254
|
+
|
|
255
|
+
Counterfactual reasoning is the deepest level of causal understanding — it asks "what if it had been otherwise," whether formal SCM or daily reflection, we must acknowledge its unverifiability.
|
|
256
|
+
|
|
257
|
+
### 第六步:实验设计验证 / Experimental Design for Verification
|
|
258
|
+
|
|
259
|
+
#### 科研模式 / Research Mode
|
|
260
|
+
|
|
261
|
+
**RCT 作为黄金标准 / RCT as Gold Standard**:
|
|
262
|
+
- 随机化切断所有指向 X 的因果箭头——随机分配使处理组与对照组在所有变量(已知与未知)上期望相等
|
|
263
|
+
- 随机化直接阻断所有后门路径,无需识别混淆变量
|
|
264
|
+
- ATE = E[Y|随机分配X=1] - E[Y|随机分配X=0] = E[Y|do(X=1)] - E[Y|do(X=0)]
|
|
265
|
+
|
|
266
|
+
**当 RCT 不可能时 / When RCT is Impossible**:
|
|
267
|
+
|
|
268
|
+
- **自然实验 / Natural Experiments**:利用自然发生的随机化事件(如地震、政策变更)作为"准随机化"
|
|
269
|
+
- **工具变量 / Instrumental Variables (IV)**:变量 V 是工具变量,若 V→X 且 V 到 Y 无直接路径、V 与 Y 无共同原因——利用 V 创造的 X 的变异来估计因果效应
|
|
270
|
+
- **双重差分 / Difference-in-Differences (DD)**:比较处理组与对照组在干预前后差异的变化——DD = (Y₁^处理后 - Y₁^处理前) - (Y₀^处理后 - Y₀^处理前)
|
|
271
|
+
|
|
272
|
+
#### 生活模式 / Life Mode
|
|
273
|
+
|
|
274
|
+
如何验证因果关系?最可靠的方法是做实验——把人随机分成两组,一组做X一组不做,看结果是否不同。如果不能做实验,找自然发生的对比情境
|
|
275
|
+
|
|
276
|
+
How to verify causal relationships? The most reliable method is experimentation — randomly divide people into two groups, one does X and one doesn't, see if results differ. If experiments aren't possible, find naturally occurring comparison scenarios
|
|
277
|
+
|
|
278
|
+
- 最可靠:随机实验——两组人完全一样,唯一的差别是"是否做了X"
|
|
279
|
+
- 退而求其次:自然对比——找到恰好相似但X不同的情境进行比较
|
|
280
|
+
- 日常可用:小规模试错——自己尝试做/不做X,观察结果变化(但要注意其他变量也在变化)
|
|
281
|
+
|
|
282
|
+
#### 共通要点 / Shared Essentials
|
|
283
|
+
|
|
284
|
+
验证因果的核心是"随机化"或"等价比较"——无论是 RCT 还是日常小实验,都需要尽量排除其他变量的干扰。
|
|
285
|
+
|
|
286
|
+
The core of causal verification is "randomization" or "equivalent comparison" — whether RCT or daily small experiments, we must try to eliminate interference from other variables.
|
|
287
|
+
|
|
288
|
+
### 第七步:敏感性分析 / Sensitivity Analysis
|
|
289
|
+
|
|
290
|
+
#### 科研模式 / Research Mode
|
|
291
|
+
|
|
292
|
+
因果结论对未观测混淆有多脆弱?量化混淆必须有多强才能推翻结论。
|
|
293
|
+
|
|
294
|
+
- **Rosenbaum 方法**:对于给定的混淆强度 Γ,计算因果结论可能翻转的最大 p-value——Γ 越大,结论越脆弱
|
|
295
|
+
- **E-value**:使观察到的效应估计归零所需的混淆最小强度——E-value 越大,结论越稳健
|
|
296
|
+
- **关键问题**:如果存在一个未观测混淆变量 U,它必须多强(与 X 和 Y 的关联必须多大)才能使因果结论不再成立?
|
|
297
|
+
|
|
298
|
+
#### 生活模式 / Life Mode
|
|
299
|
+
|
|
300
|
+
因果结论有多脆弱?如果有一个你没考虑到的隐藏因素,它得多强才能推翻你的结论?——越脆弱,越要谨慎
|
|
301
|
+
|
|
302
|
+
How fragile is the causal conclusion? If there's a hidden factor you haven't considered, how strong would it need to be to overturn your conclusion? — the more fragile, the more cautious you should be
|
|
303
|
+
|
|
304
|
+
- 问问自己:有没有遗漏的混淆因素?如果有,它得多重要才能改变结论?
|
|
305
|
+
- 如果结论很容易被推翻,就不要太自信——谨慎行事
|
|
306
|
+
- 越重要的决策,越需要做敏感性检查——确保结论足够稳健
|
|
307
|
+
|
|
308
|
+
#### 共通要点 / Shared Essentials
|
|
309
|
+
|
|
310
|
+
敏感性分析是因果推理的"安全网"——无论是形式化的 Rosenbaum Γ 还是日常的"还能有多强"判断,都在检验结论的稳健性。
|
|
311
|
+
|
|
312
|
+
Sensitivity analysis is the "safety net" of causal reasoning — whether formal Rosenbaum Γ or daily "how strong could it be" judgment, both test the robustness of conclusions.
|
|
313
|
+
|
|
314
|
+
## 常见错误 / Common Errors
|
|
315
|
+
|
|
316
|
+
| 错误 / Error | 数学批评 / Mathematical Critique | 正确做法 / Correct Approach |
|
|
317
|
+
|---|---|---|
|
|
318
|
+
| 从相关直接推断因果 / Inferring causation from correlation directly `[科研/通用/生活]` | P(y|x) ≠ P(y|do(x));相关可能由混淆变量创造,而非因果机制 | 画 DAG 识别混淆路径,用后门调整计算 P(y|do(x)) |
|
|
319
|
+
| 忽略混淆变量 / Ignoring confounders `[科研/通用/生活]` | 不调整混淆时,|P(y|do(x)) - P(y|x)| = 混淆偏差;效应估计有偏且方向可能错误 | 识别 X 和 Y 的所有共同祖先,对可观测混淆做调整 |
|
|
320
|
+
| 混淆 do(x) 与条件化 P(y|x) / Confounding do(x) with conditioning P(y|x) `[科研/通用]` | do(x) 切断所有指向 X 的箭头;条件化 x 不切断任何箭头——两者数学含义不同 | 明确区分:do(x) 是干预("强制设定 X=x"),P(y|x) 是观察("看到 X=x 时 Y 如何") |
|
|
321
|
+
| 忽略中介效应 / Ignoring mediation effects `[科研/通用]` | X→M→Y 中,总效应 = 直接效应 + 间接效应;忽略中介会混淆因果路径 | 进行中介分析,拆分直接效应与间接效应(前门准则可利用中介) |
|
|
322
|
+
| 过度依赖单一因果假设 / Over-relying on a single causal assumption (DAG may be wrong) `[科研]` | DAG 的错误导致因果结论全盘错误;不同 DAG 可能给出相反结论 | 检验 DAG 的合理性;比较多个备选 DAG;进行敏感性分析 |
|
|
323
|
+
| 忽略敏感性分析 / Skipping sensitivity analysis `[科研]` | 未观测混淆可能推翻因果结论;不评估脆弱性则结论不可靠 | 用 Rosenbaum 方法或 E-value 量化结论对未观测混淆的脆弱性 |
|
|
324
|
+
| 把相关当因果 / Mistaking correlation for causation `[生活]` | 日常生活中最常见的错误——"看到X和Y一起出现"就认为"X导致Y" | 问自己:有没有隐藏的共同原因?X和Y是否只是恰好同时出现? |
|
|
325
|
+
| 忽略隐藏的共同原因 / Ignoring hidden common causes `[生活]` | 隐藏因素同时影响X和Y,制造虚假因果——比如"健康习惯"同时影响"喝咖啡"和"健康状况" | 检查有没有同时影响"原因"和"结果"的隐藏因素——寻找上游的共同原因 |
|
|
326
|
+
| 轻信"做了X就有效"而没验证 / Believing "doing X works" without verification `[生活]` | 观察到的效果可能是混淆偏差而非真实因果效应——没有验证就行动可能误导决策 | 找对比情境验证:有没有不做X但结果一样的情况?做小规模试错再全面推行 |
|
|
327
|
+
|
|
328
|
+
## 操作规程 / Operating Procedure
|
|
329
|
+
|
|
330
|
+
当本 skill 被触发时,根据模式选择输出格式:
|
|
331
|
+
|
|
332
|
+
### 模式选择 / Mode Selector
|
|
333
|
+
|
|
334
|
+
- **科研模式**:当问题涉及干预效果评估、政策评估、DAG建模、do-calculus时使用
|
|
335
|
+
**Research Mode**: Use when the question involves intervention effect evaluation, policy evaluation, DAG modeling, do-calculus
|
|
336
|
+
- **生活模式**:当问题涉及区分原因与借口、反事实思考、评估某事是否真的有效时使用
|
|
337
|
+
**Life Mode**: Use when the question involves distinguishing cause from excuse, counterfactual thinking, evaluating whether something truly works
|
|
338
|
+
|
|
339
|
+
### 科研模式输出格式 / Research Mode Output Format
|
|
340
|
+
|
|
341
|
+
1. **[DAG]:[因果图]**:画出所有变量的有向无环图,标注每条因果箭头的假设依据
|
|
342
|
+
2. **[混淆变量]:[列表]**:列出 X 和 Y 的所有共同祖先,标注哪些可观测、哪些不可观测
|
|
343
|
+
3. **[识别策略]:[后门/前门/do算子]**:根据混淆可观测性选择识别策略,说明选择理由
|
|
344
|
+
4. **[干预效果]:P(y|do(x))=[值]**:用调整公式计算因果效应,与观察性关联对比
|
|
345
|
+
5. **[反事实]:[分析]**:对关键个体或子群体进行反事实推理,说明所需结构方程
|
|
346
|
+
6. **[验证方法]:[RCT/自然实验/IV/DD]**:说明如何用实验或准实验方法验证因果结论
|
|
347
|
+
7. **[敏感性]:[评估]**:量化因果结论对未观测混淆的脆弱性(Rosenbaum Γ 或 E-value)
|
|
348
|
+
|
|
349
|
+
**科研模式输出必须包含以上 7 项,不得只输出分析性文字而不给出结论。**
|
|
350
|
+
|
|
351
|
+
### 生活模式输出格式 / Life Mode Output Format
|
|
352
|
+
|
|
353
|
+
1. **[因果链]:[分析]** — X真的导致Y吗?还是它们只是恰好同时出现?画出因果链
|
|
354
|
+
**[Causal Chain]:[Analysis]** — Does X truly cause Y? Or do they just happen to co-occur? Draw the causal chain
|
|
355
|
+
2. **[隐藏因素]:[列表]** — 有没有同时影响X和Y的隐藏因素
|
|
356
|
+
**[Hidden Factors]:[List]** — Are there hidden factors that simultaneously influence X and Y
|
|
357
|
+
3. **[真实效果]:[判断]** — 如果我真的做了X,结果会怎样(而不是"看到X时结果如何")
|
|
358
|
+
**[True Effect]:[Judgment]** — What would happen if I actually did X (not "how things are when we see X")
|
|
359
|
+
4. **[反事实]:[思考]** — 如果当初没做X/做了X,结果会怎样
|
|
360
|
+
**[Counterfactual]:[Thinking]** — What if I hadn't done X / had done X, what would the result be
|
|
361
|
+
5. **[验证方式]:[建议]** — 如何验证这个因果判断是否可靠
|
|
362
|
+
**[Verification]:[Suggestion]** — How to verify whether this causal judgment is reliable
|
|
363
|
+
6. **[行动建议]:[步骤]** — 在当前因果判断下最务实的行动方案
|
|
364
|
+
**[Action Advice]:[Steps]** — The most pragmatic action plan given the current causal judgment
|
|
365
|
+
|
|
366
|
+
**生活模式输出必须包含以上 6 项,不得只输出分析性文字而不给出结论。**
|
|
367
|
+
|
|
368
|
+
## 与其他 skill 的关系 / Relations to Other Skills
|
|
369
|
+
|
|
370
|
+
- **概率与统计**:统计是因果的基础但不充分——P(y|x) 是统计关联,P(y|do(x)) 是因果效应;因果需要额外假设
|
|
371
|
+
- **建模思想**:因果 DAG 是结构模型——编码变量间的因果机制假设,是建模的因果版本
|
|
372
|
+
- **逻辑演绎**:因果推理的演绎链条——从 DAG 假设出发,通过 do-演算三条规则演绎出因果结论
|
|
373
|
+
- **信息论思想**:信号与信息不对称——混淆变量制造虚假信号,因果推断从噪声中提取真实因果信号
|
|
374
|
+
- **博弈思想**:策略互动中的因果——参与者的策略选择构成因果干预,均衡分析需要因果推理
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# 数学出处与经典文献 / Mathematical Sources and Classic Texts
|
|
2
|
+
|
|
3
|
+
## Wright 路径分析与 DAG / Wright's Path Analysis and DAGs (1921)
|
|
4
|
+
|
|
5
|
+
> 路径系数 p_{ij}:变量 i 对变量 j 的直接因果效应的标准化度量。
|
|
6
|
+
> 每条从 i 到 j 的路径的总效应 = 路径上各系数的乘积。
|
|
7
|
+
|
|
8
|
+
**含义**:因果结构可以用有向图表示,因果效应可以在图上沿路径计算——这是因果 DAG 的起源。
|
|
9
|
+
|
|
10
|
+
**数学背景**:Sewall Wright (1921) 在研究遗传学时发明路径图(path diagrams),用于分解性状的遗传与环境成分。路径分析的本质是结构方程模型(SEM)的图表示:每个变量的值由其直接原因和外生误差项决定,Y = Σ β_{ij}·X_j + ε_j。Wright 的路径追踪规则允许沿 DAG 路径计算变量间的总关联:r_{XY} = Σ(路径上系数乘积)。这一方法为 Pearl 的 DAG 框架奠定了基础。
|
|
11
|
+
|
|
12
|
+
**Significance**: Causal structure can be represented with directed graphs, and causal effects can be computed along paths on the graph — this is the origin of causal DAGs. Wright invented path diagrams in genetics to decompose hereditary and environmental components of traits. Path analysis is essentially the graphical representation of structural equation models (SEM).
|
|
13
|
+
|
|
14
|
+
**关键公式**:路径追踪规则(Wright's tracing rule):变量 i 与 j 间的总关联 r_{ij} = Σ(沿 i→j 的每条开放路径上路径系数乘积)。开放路径是指不经过同一变量两次(无回路)且不含"对撞"(collider)的路径——对撞是两条箭头同时指向的节点。对撞节点默认阻断路径,但若对撞被条件化,则路径重新开放——这就是"对撞偏差"(collider bias)的来源。
|
|
15
|
+
|
|
16
|
+
**Key formula**: Wright's tracing rule: total association r_{ij} = Σ(product of path coefficients along each open path from i to j). An open path has no loops and no colliders (nodes receiving two arrows). Colliders block paths by default, but conditioning on a collider opens the path — the origin of "collider bias."
|
|
17
|
+
|
|
18
|
+
## Fisher 随机化实验 / Fisher's Randomized Experiments (1935)
|
|
19
|
+
|
|
20
|
+
> 随机化不是忽视因果,而是使因果推断成为可能。
|
|
21
|
+
> 随机分配切断所有指向处理变量的因果箭头。
|
|
22
|
+
|
|
23
|
+
**含义**:科学实验的可信度不来自"精密控制",而来自"随机分配"——随机化是因果推断的黄金标准。
|
|
24
|
+
|
|
25
|
+
**数学背景**:R.A. Fisher 在《The Design of Experiments》(1935) 中提出随机化原则。核心论证:若处理 T 随机分配给个体,则 T 与任何混淆变量 Z 独立(P(Z|do(T)) = P(Z)),因此 P(Y|do(T)) = P(Y|T)。随机化消除了所有后门路径,无需识别具体混淆变量。Fisher 还提出零假设下的精确检验(permutation test):在 T 无效应假设下,所有可能分配的 Y 值分布相同,p-value = "观察到当前或更极端分配的概率"。
|
|
26
|
+
|
|
27
|
+
**Significance**: The credibility of scientific experiments comes not from "precise control" but from "random assignment" — randomization is the gold standard for causal inference. Fisher showed that if treatment T is randomly assigned, T is independent of any confounder Z, so P(Y|do(T)) = P(Y|T). Randomization eliminates all back-door paths without needing to identify specific confounders.
|
|
28
|
+
|
|
29
|
+
**Fisher 精确检验与置换推断**:Fisher 的 lady tasting tea 实验是随机化推断的经典案例。一位女士声称能分辨茶是先加奶还是后加奶。Fisher 设计了 8 杯茶(4 杯先加奶、4 杯后加奶),随机顺序呈现。在"女士无辨别能力"(零假设)下,正确猜中 4 杯先加奶的概率 = 1/C(8,4) = 1/70 ≈ 0.014。这一 p-value 不依赖任何分布假设——它完全基于随机化分配,是置换检验(permutation test)的起源。
|
|
30
|
+
|
|
31
|
+
## Wright 工具变量 / Wright's Instrumental Variables (1928)
|
|
32
|
+
|
|
33
|
+
> 工具变量 V 满足:(1) V → X(影响处理),(2) V 与 Y 无直接路径,(3) V 与 Y 无共同原因。
|
|
34
|
+
> IV 估计量:β_{IV} = Cov(Y,V)/Cov(X,V)。
|
|
35
|
+
|
|
36
|
+
**含义**:当混淆变量不可观测时,工具变量可以利用"外生变异"来估计因果效应——IV 创造的 X 的变异不受混淆影响。
|
|
37
|
+
|
|
38
|
+
**数学背景**:Philip Sewall Wright (1928) 在估计亚麻籽需求弹性时首次提出工具变量方法。他需要估计价格对需求量的因果效应,但价格与需求量之间存在双向因果关系(混淆)。Wright 引入一个只影响供给(从而影响价格)但不直接影响需求量的变量作为工具。IV 估计的逻辑:Cov(Y,V) = β_{因果}·Cov(X,V) + Cov(混淆,U·V),但 V 与混淆独立所以 Cov(混淆,U·V)=0,于是 β_{因果} = Cov(Y,V)/Cov(X,V)。当 IV 弱(Cov(X,V) 小),IV 估计的方差膨胀,需警惕弱工具变量问题。
|
|
39
|
+
|
|
40
|
+
**Significance**: When confounders are unobserved, instrumental variables exploit "exogenous variation" to estimate causal effects — the variation in X created by IV is unaffected by confounding. Wright first proposed IV estimation for flaxseed demand elasticity. The logic: since V is independent of confounders, β_{causal} = Cov(Y,V)/Cov(X,V). Weak IV (small Cov(X,V)) inflates variance — beware of weak instrument problems.
|
|
41
|
+
|
|
42
|
+
**经典 IV 案例**:
|
|
43
|
+
|
|
44
|
+
- **Angrist & Krueger (1991)**:用出生季度作为教育年数的工具变量——出生在年初的人因入学年龄规定而被迫多上一年学。IV 估计的教育回报率约 7%,高于 OLS 的 5%(OLS 受能力混淆向下偏)。
|
|
45
|
+
- **两阶段最小二乘 (2SLS)**:第一阶段 X̂ = π₀ + π₁·V(用 IV 预测 X);第二阶段 Y = β₀ + β₁·X̂(用预测值估计因果效应)。当 IV 强时(F-statistic > 10),2SLS 可靠;当 IV 弱时,2SLS 偏向 OLS 且置信区间膨胀。
|
|
46
|
+
|
|
47
|
+
**Classic IV cases**: Angrist & Krueger (1991) used birth quarter as IV for education years — those born early in the year were forced to attend more school. IV-estimated education return ~7% vs OLS ~5% (OLS biased down by ability confounding). 2SLS: first stage X̂ = π₀ + π₁·V, second stage Y = β₀ + β₁·X̂. Reliable when F > 10 (strong IV); biased toward OLS when IV is weak.
|
|
48
|
+
|
|
49
|
+
## Lewis 反事实语义 / Lewis's Counterfactual Semantics (1973)
|
|
50
|
+
|
|
51
|
+
> "如果 A 发生了(实际上没有),C 会怎样?" ——在 A 成立的可能世界中,C 是否成立?
|
|
52
|
+
> Counterfactual: "If A had occurred (which it didn't), would C have happened?" — In the possible world where A holds, does C hold?
|
|
53
|
+
|
|
54
|
+
**含义**:因果陈述本质上涉及反事实——"A 导致 C"意味着"如果 A 没发生,C 就不会发生"。反事实推理需要比较不同的可能世界。
|
|
55
|
+
|
|
56
|
+
**数学背景**:David Lewis (1973) 在《Counterfactuals》中提出可能世界语义来分析反事实条件句。核心概念:相似性 ordering — 在 A 成立的可能世界中,最接近现实世界的那个决定了反事实的真值。Lewis 的 VC (Variably Strict Conditional) 系统:A □→ C 为真,若在所有最接近的 A-世界中 C 成立。这一哲学框架为 Pearl 的结构因果模型中的反事实计算提供了语义基础——SCM 的反事实 Y_x(u) 就是在"设定 X=x"的可能世界中个体 u 的 Y 值。
|
|
57
|
+
|
|
58
|
+
**Significance**: Causal claims inherently involve counterfactuals — "A caused C" means "if A hadn't occurred, C wouldn't have." Counterfactual reasoning requires comparing different possible worlds. Lewis proposed possible-world semantics: the closest A-world to reality determines the truth of the counterfactual. This philosophical framework provided the semantic basis for Pearl's SCM counterfactuals — Y_x(u) is the value of Y for individual u in the world where X is set to x.
|
|
59
|
+
|
|
60
|
+
## Rubin 潜在结果框架 / Rubin's Potential Outcomes Framework (1974)
|
|
61
|
+
|
|
62
|
+
> 对于个体 i:Y_i(1) 为处理下的潜在结果,Y_i(0) 为对照下的潜在结果。
|
|
63
|
+
> 个体因果效应:τ_i = Y_i(1) - Y_i(0)(永远不可同时观测)。
|
|
64
|
+
> 平均处理效应:ATE = E[Y(1) - Y(0)]。
|
|
65
|
+
|
|
66
|
+
**含义**:因果效应是两个潜在结果之差——但每个个体只能观测到一个潜在结果,这是因果推断的根本难题("因果推断的根本问题" / fundamental problem of causal inference)。
|
|
67
|
+
|
|
68
|
+
**数学背景**:Donald Rubin (1974) 将 Neyman (1923) 在农业实验中的随机化推断框架推广为一般性的潜在结果模型(Neyman-Rubin causal model)。关键假设 SUTVA(Stable Unit Treatment Value Assumption):(1) 个体 i 的潜在结果不受他人处理分配影响,(2) 处理形式唯一(无不同版本)。在随机化下,ATE 的无偏估计为 τ̂ = Ȳ_1 - Ȳ_0。Rubin 的框架与 Pearl 的 DAG 框架是等价的:潜在结果模型是 SCM 中结构方程的隐式表示,DAG 是潜在结果模型中因果假设的显式表示。
|
|
69
|
+
|
|
70
|
+
**Significance**: The causal effect is the difference between two potential outcomes — but only one can be observed per individual, the "fundamental problem of causal inference." Rubin extended Neyman's framework into the general potential outcomes model (Neyman-Rubin causal model). SUTVA ensures no interference between units. Under randomization, ATE is unbiasedly estimated by τ̂ = Ȳ_1 - Ȳ_0. Rubin's framework is equivalent to Pearl's: potential outcomes are implicit structural equations, DAGs are explicit causal assumptions.
|
|
71
|
+
|
|
72
|
+
## Pearl 因果层级与 do-演算 / Pearl's Causal Hierarchy and Do-Calculus (2000)
|
|
73
|
+
|
|
74
|
+
> 因果层级:
|
|
75
|
+
> Level 1:P(y|x) — 关联 / Seeing
|
|
76
|
+
> Level 2:P(y|do(x)) — 干预 / Doing
|
|
77
|
+
> Level 3:P(y_x|x',y') — 反事实 / Imagining
|
|
78
|
+
>
|
|
79
|
+
> do-演算三条规则允许将干预表达式转化为可观测量。
|
|
80
|
+
|
|
81
|
+
**含义**:因果不是关联的强化版——"do(x)" 与 "observe x" 在数学上截然不同。do-演算提供了从观测数据计算因果效应的完整逻辑系统。
|
|
82
|
+
|
|
83
|
+
**数学背景**:Judea Pearl 在《Causality》(2000) 中建立了因果推断的数学框架。核心贡献:(1) 因果层级将推理能力从关联到干预到反事实分为三层,每层需要更强的建模假设;(2) do-演算三条规则给出了将 do-表达式转化为无 do 的可观测量表达式的完整规则集;(3) Pearl 证明了 do-演算的完备性——若一个 do-表达式可以转化为可观测量表达式,do-演算的三条规则必能找到这一转化。后门准则和前门准则是 do-演算的最重要特例。
|
|
84
|
+
|
|
85
|
+
**Significance**: Causation is not a strengthened version of correlation — "do(x)" and "observe x" are mathematically distinct. Do-calculus provides a complete logical system for computing causal effects from observational data. Pearl proved completeness: if a do-expression can be converted to an observational expression, the three rules of do-calculus will find it. The back-door and front-door criteria are the most important special cases.
|
|
86
|
+
|
|
87
|
+
## Card & Krueger 双重差分 / Card & Krueger Difference-in-Differences (1994)
|
|
88
|
+
|
|
89
|
+
> DD = (Y₁^{post} - Y₁^{pre}) - (Y₀^{post} - Y₀^{pre})
|
|
90
|
+
> 处理组的前后变化减去对照组的前后变化 = 纯因果效应。
|
|
91
|
+
|
|
92
|
+
**含义**:当 RCT 不可能时,可以利用干预前后处理组与对照组的差异变化来估计因果效应——前提是平行趋势假设成立。
|
|
93
|
+
|
|
94
|
+
**数学背景**:David Card 与 Alan Krueger (1994) 在研究最低工资对就业的影响时,比较了新泽西(提高最低工资)与宾夕法尼亚(未提高)的快餐业就业变化。DD 的关键假设:若无干预,处理组与对照组的趋势相同(平行趋势假设)。数学上,DD 估计量 τ̂_{DD} = (Ȳ_{NJ,post} - Ȳ_{NJ,pre}) - (Ȳ_{PA,post} - Ȳ_{PA,pre})。当平行趋势成立时,τ̂_{DD} = ATE。平行趋势可部分检验:比较干预前两个组的时间趋势是否一致。
|
|
95
|
+
|
|
96
|
+
**Significance**: When RCT is impossible, difference-in-differences estimates causal effects by comparing pre-post changes between treatment and control groups — provided the parallel trends assumption holds. Card & Krueger studied minimum wage effects on employment by comparing New Jersey (raised minimum wage) with Pennsylvania (did not). The parallel trends assumption can be partially tested by comparing pre-intervention trends.
|
|
97
|
+
|
|
98
|
+
## 中介分析:直接与间接效应 / Mediation Analysis: Direct and Indirect Effects
|
|
99
|
+
|
|
100
|
+
> X → M → Y:间接效应 = X 通过 M 对 Y 的影响
|
|
101
|
+
> X → Y:直接效应 = X 不通过 M 对 Y 的直接影响
|
|
102
|
+
> 总效应 = 直接效应 + 间接效应
|
|
103
|
+
|
|
104
|
+
**含义**:因果效应可以沿不同路径传播——拆分直接与间接效应有助于理解因果机制。
|
|
105
|
+
|
|
106
|
+
**数学背景**:Baron & Kenny (1986) 提出中介分析的经典方法(逐步回归法),但该方法有严重缺陷:依赖线性假设、忽略交互效应、无法处理混淆。Pearl (2001) 提出因果中介分析的定义:自然直接效应 NDE = E[Y_{x,M_{x'}}] - E[Y_{x',M_{x'}}](将 M 设为 x' 下自然值时,X 从 x' 变为 x 的效应);自然间接效应 NIE = E[Y_{x',M_x}] - E[Y_{x',M_{x'}}](X 保持 x' 时,M 从 x' 下自然值变为 x 下自然值的效应)。总效应 = NDE + NIE。这一定义不依赖线性假设。
|
|
107
|
+
|
|
108
|
+
**Significance**: Causal effects propagate along different paths — decomposing direct and indirect effects helps understand causal mechanisms. Baron & Kenny's (1986) classic method has serious flaws. Pearl (2001) defined causal mediation: natural direct effect NDE and natural indirect effect NIE, without requiring linearity. Total effect = NDE + NIE.
|
|
109
|
+
|
|
110
|
+
## Rosenbaum 敏感性分析 / Rosenbaum's Sensitivity Analysis (2002)
|
|
111
|
+
|
|
112
|
+
> 给定混淆强度 Γ:最大 odds ratio P(U=1|T=1)/P(U=1|T=0) ≤ Γ。
|
|
113
|
+
> 计算:在 Γ 下因果结论可能翻转的最大 p-value。
|
|
114
|
+
|
|
115
|
+
**含义**:因果结论必须评估其脆弱性——如果未观测混淆只需强度 Γ 就能推翻结论,则结论不稳健。
|
|
116
|
+
|
|
117
|
+
**数学背景**:Paul Rosenbaum 在《Observational Studies》(2002) 中系统化敏感性分析方法。核心思想:在随机化下 Γ=1(处理与混淆完全独立),Γ>1 表示存在未观测混淆的可能。对每个 Γ,计算:在最强可能混淆下,处理效应的最小 p-value。若 Γ=2 时 p-value 已超过显著性阈值,则结论对较弱混淆就脆弱;若 Γ=5 时 p-value 仍显著,则结论非常稳健。E-value (VanderWeele & Ding, 2017) 是相关概念:使效应估计归零所需的最小混淆强度,E-value = ATE + √(ATE² + ATE)。
|
|
118
|
+
|
|
119
|
+
**Significance**: Causal conclusions must be assessed for robustness — if an unobserved confounder of strength Γ can overturn the conclusion, it's fragile. Rosenbaum's method: for each Γ, compute the maximum p-value under the strongest possible confounding. If the conclusion remains significant at Γ=5, it's robust. The E-value quantifies the minimum confounding strength needed to nullify the effect estimate.
|
|
120
|
+
|
|
121
|
+
## Pearl 结构因果模型 / Pearl's Structural Causal Models (SCM)
|
|
122
|
+
|
|
123
|
+
> SCM = ⟨U, V, F, P(U)⟩
|
|
124
|
+
> U = 外生变量(不可观测的个体特征),V = 内生变量(可观测),F = 结构方程 {f_V}, P(U) = 外生分布
|
|
125
|
+
>
|
|
126
|
+
> 结构方程:V_i = f_i(PA_i, U_i),PA_i = V_i 的直接原因(父母节点)
|
|
127
|
+
|
|
128
|
+
**含义**:结构因果模型是因果推断的完整数学框架——它同时编码因果假设(DAG)、干预(do-演算)和反事实(结构方程)。
|
|
129
|
+
|
|
130
|
+
**数学背景**:Pearl 的 SCM 框架统一了因果推断的三个层级。核心数学对象:(1) DAG 编码因果假设——箭头 PA_i → V_i 表示 PA_i 是 V_i 的直接原因;(2) 结构方程 V_i = f_i(PA_i, U_i) 编码因果机制——f_i 是因果函数而非统计回归;(3) 干预 do(X=x) 的数学操作:将 X 的结构方程替换为 X=x,保持其他方程不变;(4) 反事实 Y_x(u) 的计算:在修改后的模型(X=x)中,给定外生变量 U=u,计算 Y 的值。SCM 的关键性质:从 SCM 可以推导出所有 Level 1-3 的量;反之,仅从 Level 1 数据无法唯一确定 SCM。
|
|
131
|
+
|
|
132
|
+
**Significance**: Structural Causal Models provide the complete mathematical framework for causal inference — they simultaneously encode causal assumptions (DAG), interventions (do-calculus), and counterfactuals (structural equations). The key property: from an SCM, all Level 1-3 quantities can be derived; conversely, Level 1 data alone cannot uniquely determine the SCM.
|
|
133
|
+
|
|
134
|
+
## 因果推断的根本问题 / The Fundamental Problem of Causal Inference
|
|
135
|
+
|
|
136
|
+
> 对于个体 i:τ_i = Y_i(1) - Y_i(0)
|
|
137
|
+
> 我们永远无法同时观测 Y_i(1) 和 Y_i(0)——只能看到其中一个。
|
|
138
|
+
|
|
139
|
+
**含义**:个体因果效应永远不可直接观测——这是因果推断的根本难题。一切因果推断方法本质上都是在试图用部分信息推断完整效应。
|
|
140
|
+
|
|
141
|
+
**数学背景**:Holland (1986) 明确阐述了这一根本问题。每个个体 i 有两个潜在结果 Y_i(treated) 和 Y_i(control),但现实世界只呈现其中一个。一切因果推断策略本质上都是绕过这一限制:(1) 随机化——用群体均值替代个体效应;(2) 前后比较——用个体之前状态近似对照状态(假设无时间趋势);(3) 回归调整——用可观测特征匹配近似个体;(4) 反事实建模——用结构方程预测未观测的潜在结果。每种策略都有其假设,违反假设则结论无效。
|
|
142
|
+
|
|
143
|
+
**Significance**: Individual causal effects can never be directly observed — this is the fundamental problem of causal inference. All causal inference strategies circumvent this limitation: (1) randomization — replace individual effects with group means; (2) before-after comparison — approximate control state; (3) regression adjustment — match on observables; (4) counterfactual modeling — predict unobserved potential outcomes. Each strategy has assumptions; violating them invalidates conclusions.
|
|
144
|
+
|
|
145
|
+
## Simpson 悖论与因果结构 / Simpson's Paradox and Causal Structure
|
|
146
|
+
|
|
147
|
+
> 同一数据在不同分组下给出相反结论:
|
|
148
|
+
> 整体:处理组恢复率更高;分组(按病情严重度):处理组恢复率更低。
|
|
149
|
+
|
|
150
|
+
**含义**:统计关联的方向取决于分析维度——Simpson 悖论揭示纯统计推理无法确定"哪个分组是正确的",必须依赖因果假设。
|
|
151
|
+
|
|
152
|
+
**数学背景**:Simpson 悖论的本质是混淆变量的干扰。经典案例:药物试验中,轻度患者多数被分配到处理组(恢复率高),重度患者多数被分配到对照组(恢复率低)。整体看处理组恢复率更高(因为处理组多为轻度患者),但按病情分组后处理组恢复率更低(药物实际有害)。Pearl 的因果解释:若病情 Z 是混淆变量(Z→T 且 Z→Y),则 P(Y|T=1) > P(Y|T=0) 是虚假关联,正确的因果效应 P(Y|do(T=1)) < P(Y|do(T=0)) 需要后门调整 P(Y|do(T)) = Σ_z P(Y|T,z)·P(z)。因果 DAG 决定了"应该按 Z 分组还是按整体计算"——没有因果模型,统计方法本身无法给出答案。
|
|
153
|
+
|
|
154
|
+
**Significance**: The direction of statistical association depends on the level of analysis — Simpson's paradox reveals that pure statistical reasoning cannot determine "which grouping is correct"; causal assumptions are required. Pearl's explanation: if Z is a confounder (Z→T and Z→Y), P(Y|T=1) > P(Y|T=0) is spurious. The correct causal effect P(Y|do(T=1)) < P(Y|do(T=0)) requires back-door adjustment. The causal DAG determines whether to condition on Z or not — without a causal model, statistics alone cannot answer.
|
|
155
|
+
|
|
156
|
+
## d-分离与条件独立性 / d-Separation and Conditional Independence
|
|
157
|
+
|
|
158
|
+
> 在 DAG G 中,路径 p 被 Z d-阻断,若 p 包含:
|
|
159
|
+
> (1) 一个链 A→B→C 且 B∈Z,或
|
|
160
|
+
> (2) 一个叉 A←B→C 且 B∈Z,或
|
|
161
|
+
> (3) 一个对撞 A→B←C 且 B∉Z(且 B 的后代∉Z)。
|
|
162
|
+
|
|
163
|
+
**含义**:d-分离是 DAG 编码的条件独立性——若 X 与 Y 被 Z d-分离,则 X ⊥ Y | Z 在所有由 G 产生的分布中成立。
|
|
164
|
+
|
|
165
|
+
**数学背景**:d-分离(directed separation)是 Pearl (1988) 提出的概念,连接因果图结构与概率分布的独立性。三条阻断规则对应三种路径类型:链(因果传导路径)、叉(混淆路径)、对撞(选择偏差路径)。d-分离的关键性质:(1) 若 X 与 Y 被 Z d-分离,则数据中应观察到 X ⊥ Y | Z——若观察到 X 与 Y 在给定 Z 时仍相关,则 DAG 可能错误;(2) d-分离是 DAG 的蕴涵——不需要知道具体参数值,仅从图结构即可推断独立性;(3) d-分离是因果推理的基础——后门路径就是不被空集 d-阻断的非因果路径。
|
|
166
|
+
|
|
167
|
+
**Significance**: d-separation is the conditional independence encoded by the DAG — if X and Y are d-separated by Z, then X ⊥ Y | Z holds in all distributions generated by G. The three blocking rules correspond to: chains (causal transmission), forks (confounding), colliders (selection bias). d-separation is foundational for causal reasoning — back-door paths are exactly non-causal paths not d-separated by the empty set.
|