Skip to content

Causal Inference: What If 第 7-10 章中英对照

原书: Causal Inference: What If
作者: Miguel A. Hernán, James M. Robins
出版社: Chapman & Hall/CRC (2020)
ISBN: 978-1-4398-8662-5
官方链接: https://www.hsph.harvard.edu/miguel-hernan/causal-inference-book/
翻译时间: 2026-06-01
状态: 中英对照编译版
前续: 第 1-3 章, 第 4-6 章


📚 目录 (Table of Contents)

第一部分:因果推断的基本概念 (Chapters 1-10)

  • Chapter 7: Instrumental Variables (工具变量)
  • Chapter 8: Effect Modification (效应修饰)
  • Chapter 9: Causal Interaction (因果交互)
  • Chapter 10: Time-Varying Treatments (时变处理)

Chapter 7: Instrumental Variables

第 7 章:工具变量

7.1 什么是工具变量?(What is an Instrumental Variable?)

English:

An instrumental variable (IV) is a variable Z that satisfies three conditions: 1. Z is associated with the treatment A 2. Z affects the outcome Y only through A (exclusion restriction) 3. There are no common causes of Z and Y (independence assumption)

中文:

工具变量 (IV) 是满足三个条件的变量 Z: 1. Z 与处理 A 相关 2. Z 仅通过 A 影响结局 Y(排他性约束) 3. Z 和 Y 没有共同原因(独立性假设)

工具变量 DAG (IV DAG):

标准工具变量结构:

    Z (工具变量)
    A (处理) → Y (结局)
    ↑          ↑
    └── U ─────┘
       (未观测混杂)

Z 通过 A 影响 Y,不直接影响 Y
Z 与混杂 U 独立

经典示例:医生偏好 (Classic Example: Physician Preference):

研究问题:药物对死亡率的效果

工具变量 Z:医生的处方偏好
- 某些医生更倾向于开药 A,某些更倾向于开药 B
- 患者的分配部分随机(取决于哪个医生值班)
- 医生偏好不影响患者结局,除了通过药物选择

为什么是有效的 IV:
✓ 与处理相关(医生偏好影响开药)
✓ 排他性约束(偏好本身不影响结局)
✓ 独立性(患者特征与医生偏好无关)

7.2 IV 估计方法 (IV Estimation Methods)

English:

The instrumental variable estimator can be computed as the ratio of the intention-to-treat effect to the effect of the instrument on treatment.

中文:

工具变量估计量可以计算为意向治疗效应与工具变量对处理效应的比率。

Wald 估计量 (Wald Estimator):

\[ IV = \frac{E[Y|Z=1] - E[Y|Z=0]}{E[A|Z=1] - E[A|Z=0]} = \frac{\text{ITT}}{\text{First Stage}} \]

其中: - ITT: Intention-to-Treat (意向治疗效应) - First Stage: 第一阶段(Z 对 A 的影响)

两阶段最小二乘法 (Two-Stage Least Squares, 2SLS):

第一阶段 (First Stage): $$ A = \alpha_0 + \alpha_1 Z + \epsilon $$

第二阶段 (Second Stage): $$ Y = \beta_0 + \beta_1 \hat{A} + \eta $$

其中 \(\hat{A}\) 是第一阶段的预测值。

Python 实现示例 (Python Implementation):

import statsmodels.api as sm
from statsmodels.sandbox.regression.gmm import IV2SLS

# 数据
Z = df['instrument']  # 工具变量
A = df['treatment']   # 处理
Y = df['outcome']     # 结局
X = df[covariates]    # 协变量(可选)

# 2SLS 估计
model = IV2SLS(Y, sm.add_constant(X), sm.add_constant(Z))
result = model.fit(cov_type='robust')

print(result.summary)
print(f"IV Estimate: {result.params['treatment']:.3f}")

7.3 IV 假设检验 (Testing IV Assumptions)

English:

The validity of an instrumental variable cannot be fully tested, but some aspects can be examined:

中文:

工具变量的有效性无法完全检验,但可以检查某些方面:

可检验的方面 (Testable Aspects):

假设 检验方法 说明
相关性 F 统计量 第一阶段 F > 10 表示强工具变量
排他性 过度识别检验 多个 IV 时可用 Sargan 检验
独立性 平衡性检验 Z 应与观测协变量平衡

弱工具变量问题 (Weak Instrument Problem):

弱工具变量的后果:
- 估计量有偏
- 标准误不准确
- 置信区间覆盖率低

诊断:
- 第一阶段 F 统计量 < 10 表示弱工具变量
- 使用稳健方法 (如 LIML, Anderson-Rubin)

解决方案:
- 寻找更强的工具变量
- 使用多个工具变量
- 报告弱 IV 稳健的置信区间

7.4 LATE (Local Average Treatment Effect)

English:

Under the IV assumptions, the instrumental variable estimates the Local Average Treatment Effect (LATE), which is the average causal effect for the subpopulation of compliers.

中文:

在 IV 假设下,工具变量估计局部平均处理效应 (LATE),即依从者子人群的平均因果效应。

人群分类 (Population Strata):

类型 英文 定义 对 Z 的反应
依从者 Compliers 按工具变量分配接受处理 Z=1→A=1, Z=0→A=0
总是接受者 Always-takers 无论如何都接受处理 Z=1→A=1, Z=0→A=1
从不接受者 Never-takers 无论如何都不接受处理 Z=1→A=0, Z=0→A=0
反抗者 Defiers 与工具变量分配相反 Z=1→A=0, Z=0→A=1

LATE 假设 (LATE Assumptions):

  1. 单调性 (Monotonicity): 没有反抗者
  2. 排他性约束 (Exclusion Restriction): Z 仅通过 A 影响 Y
  3. 相关性 (Relevance): Z 与 A 相关
  4. 独立性 (Independence): Z 与潜在结果独立

LATE vs ATE:

估计量 目标人群 外部有效性
LATE 仅依从者 有限
ATE 全部人群 更广
TOT 实际接受处理者 中等

Chapter 8: Effect Modification

第 8 章:效应修饰

8.1 效应修饰的定义 (Definition of Effect Modification)

English:

Effect modification occurs when the causal effect of treatment A on outcome Y varies across levels of a third variable M. The variable M is called an effect modifier.

中文:

当处理 A 对结局 Y 的因果效应在第三变量 M 的不同水平上变化时,发生效应修饰。变量 M 称为效应修饰因子。

数学定义 (Mathematical Definition):

对于连续结局: $$ \text{Effect Modification} = E[Y^{a=1} - Y^{a=0} | M=1] - E[Y^{a=1} - Y^{a=0} | M=0] \neq 0 $$

对于二分结局(加法尺度): $$ RD_{M=1} \neq RD_{M=0} $$

对于二分结局(乘法尺度): $$ RR_{M=1} \neq RR_{M=0} $$


8.2 效应修饰 vs 混杂 (Effect Modification vs Confounding)

English:

Effect modification is a biological or scientific phenomenon, while confounding is a bias that should be controlled.

中文:

效应修饰是生物学或科学现象,而混杂是应该控制的偏倚。

对比表 (Comparison):

特征 效应修饰 混杂
本质 真实现象 偏倚来源
目标 描述和报告 消除或控制
统计检验 交互作用检验 平衡性检验
分层后 层间效应不同 层间效应相同
处理方法 分别报告各层效应 调整或标准化

示例对比 (Example Comparison):

效应修饰示例:
药物效果在男性中 RR=0.5,在女性中 RR=0.9
→ 真实性别差异,应分别报告

混杂示例:
粗 RR=0.7,调整后 RR=0.5
→ 年龄混杂,应报告调整后的效应

8.3 交互作用分析 (Interaction Analysis)

English:

Interaction analysis examines whether the combined effect of two treatments differs from what would be expected based on their individual effects.

中文:

交互作用分析检查两种处理的联合效应是否与基于各自单独效应的预期不同。

交互作用类型 (Types of Interaction):

尺度 无交互定义 正交互 负交互
加法 RD₁₁ = RD₁₀ + RD₀₁ RD₁₁ > RD₁₀ + RD₀₁ RD₁₁ < RD₁₀ + RD₀₁
乘法 RR₁₁ = RR₁₀ × RR₀₁ RR₁₁ > RR₁₀ × RR₀₁ RR₁₁ < RR₁₀ × RR₀₁

回归模型中的交互项 (Interaction Terms in Regression):

import statsmodels.api as sm
import statsmodels.formula.api as smf

# 无交互模型
model_no_interaction = smf.ols('outcome ~ treatment + modifier', data=df)

# 有交互模型
model_with_interaction = smf.ols('outcome ~ treatment * modifier', data=df)

# 或者显式指定
model_explicit = smf.ols('outcome ~ treatment + modifier + treatment:modifier', data=df)

result = model_with_interaction.fit()
print(result.summary)

# 交互项系数解释
interaction_effect = result.params['treatment:modifier']

8.4 分层分析 (Stratified Analysis)

English:

Stratified analysis involves estimating the treatment effect separately within each level of the effect modifier.

中文:

分层分析涉及在效应修饰因子的每个水平内分别估计处理效应。

分层分析步骤 (Stratified Analysis Steps):

步骤 1: 确定效应修饰因子 M
步骤 2: 按 M 分层 (如 M=0 和 M=1)
步骤 3: 每层内估计因果效应
步骤 4: 比较层间效应
步骤 5: 报告交互作用检验 P 值

示例输出 (Example Output):

效应修饰分析结果:

┌──────────────┬─────────────┬─────────────┬───────────┐
│ 亚组         │ 风险差 (RD) │ 95% CI      │ P 值      │
├──────────────┼─────────────┼─────────────┼───────────┤
│ 男性         │   -0.15     │ (-0.22, -0.08) │ <0.001 │
│ 女性         │   -0.05     │ (-0.12, 0.02)  │ 0.15   │
├──────────────┴─────────────┴─────────────┴───────────┤
│ 交互作用检验 (加法尺度): P = 0.02                    │
│ 结论:存在统计学显著的效应修饰                         │
└──────────────────────────────────────────────────────┘

Chapter 9: Causal Interaction

第 9 章:因果交互

9.1 因果交互的定义 (Definition of Causal Interaction)

English:

Causal interaction refers to the situation where the effect of one treatment depends on the presence or absence of another treatment. This is distinct from statistical interaction.

中文:

因果交互指的是一种处理的效应取决于另一种处理的存在或 absent 的情况。这与统计交互不同。

双处理设定 (Two-Treatment Setting):

定义四种潜在结果: - \(Y^{00}\): 两种处理都未接受 - \(Y^{10}\): 仅接受处理 A - \(Y^{01}\): 仅接受处理 B - \(Y^{11}\): 同时接受处理 A 和 B

因果交互类型 (Types of Causal Interaction):

类型 英文 定义 示例
协同 Synergistic 联合效应 > 单独效应之和 药物组合疗效增强
拮抗 Antagonistic 联合效应 < 单独效应之和 药物间相互抵消
定性 Qualitative 效应在不同处理组合下方向相反 某药对某亚组有害

9.2 充分原因交互 (Sufficient Cause Interaction)

英文:

Two treatments interact in the sufficient cause framework if both treatments are required for the outcome to occur in some individuals.

中文:

如果在某些个体中需要两种处理都有结局才会发生,则这两种处理在充分原因框架下存在交互。

充分成分原因模型 (Sufficient-Component Cause Model):

充分原因 1: [A + B + C₁] → Y
充分原因 2: [A + D + C₂] → Y
充分原因 3: [B + E + C₃] → Y

其中:
- A, B: 我们关注的处理
- C₁, C₂, C₃: 背景因素
- D, E: 其他原因

A 和 B 在充分原因 1 中同时出现
→ A 和 B 存在充分原因交互

9.3 交互的公共卫生意义 (Public Health Significance of Interaction)

英文:

Understanding causal interaction has important implications for public health interventions and policy making.

中文:

理解因果交互对公共卫生干预和政策制定有重要意义。

应用场景 (Application Scenarios):

场景 交互类型 政策含义
疫苗接种 + 口罩 协同 联合实施效果最佳
降脂药 + 运动 协同 推荐综合干预
酒精 + 某些药物 拮抗/有害 警告联合使用风险
教育 + 就业培训 协同 整合项目设计

Chapter 10: Time-Varying Treatments

第 10 章:时变处理

10.1 时变处理的挑战 (Challenges of Time-Varying Treatments)

英文:

Time-varying treatments are treatments that can change over time. Analyzing their effects requires special methods because standard approaches may introduce bias.

中文:

时变处理是随时间变化的处理。分析其效应需要特殊方法,因为标准方法可能引入偏倚。

时变混杂 (Time-Varying Confounding):

时间轴:

t=0          t=1          t=2
│            │            │
L₀ ─────→    L₁ ─────→    L₂
│            │            │
A₀ ─────→    A₁ ─────→    A₂
│            │            │
└────────────────────────→ Y

问题:
- L₁ 受 A₀ 影响
- L₁ 混杂 A₁ 与 Y 的关系
- L₁ 是中介变量也是混杂因素

标准方法 (如回归调整) 会产生偏倚
需要使用边际结构模型 (MSM)

10.2 边际结构模型 (Marginal Structural Models)

英文:

Marginal Structural Models (MSMs) are models for the marginal (population-average) effect of treatment, estimated using inverse probability of treatment weighting (IPTW).

中文:

边际结构模型 (MSM) 是处理边际(人群平均)效应的模型,使用逆处理概率加权 (IPTW) 估计。

MSM 估计步骤 (MSM Estimation Steps):

步骤 1: 估计每个时间点的处理概率
       P(Aₜ|Aₜ₋₁, Lₜ)
步骤 2: 计算稳定化权重
       SW = ∏ₜ P(Aₜ|Aₜ₋₁) / P(Aₜ|Aₜ₋₁, Lₜ)
步骤 3: 使用加权估计 MSM
       E[Yᵃ] = Σᵢ SWᵢ × Yᵢ / Σᵢ SWᵢ
步骤 4: 比较不同处理方案的结局

Python 实现示例 (Python Implementation):

import pandas as pd
import statsmodels.api as sm
from scipy.special import expit

# 纵向数据
# 每个个体有多个时间点的观测

def calculate_iptw(df, time_points=['t0', 't1', 't2']):
    """计算逆概率处理权重"""

    weights = pd.Series(1.0, index=df.index)

    for t in time_points:
        # 处理模型
        treatment_model = sm.Logit(df[f'A_{t}'], 
                                   sm.add_constant(df[[f'A_{t-1}', f'L_{t}']]))
        treatment_result = treatment_model.fit(disp=0)

        # 预测概率
        p_treated = treatment_result.predict()

        # 计算权重
        if t == time_points[0]:
            weights *= np.where(df[f'A_{t}'] == 1, 
                               1/p_treated, 
                               1/(1-p_treated))
        else:
            # 稳定化权重
            numerator = np.where(df[f'A_{t}'] == 1,
                                p_treated.mean(),
                                1 - p_treated.mean())
            weights *= numerator / np.where(df[f'A_{t}'] == 1,
                                           p_treated,
                                           1 - p_treated)

    return weights

# 计算权重
df['iptw'] = calculate_iptw(df)

# 拟合 MSM
msm_model = sm.WLS(df['Y'], 
                   sm.add_constant(df['cumulative_treatment']),
                   weights=df['iptw'])
msm_result = msm_model.fit(cov_type='robust')

print(msm_result.summary)

10.3 G 方法 (G-Methods)

英文:

G-methods are a family of methods for causal inference with time-varying treatments, including g-formula, inverse probability weighting, and g-estimation.

中文:

G 方法是用于时变处理因果推断的一系列方法,包括 g-formula、逆概率加权和 g-estimation。

G 方法对比 (G-Methods Comparison):

方法 英文 优点 缺点
G-formula G-formula 可估计任意干预 需要正确指定模型
IPTW Inverse Probability Weighting 概念简单 权重可能不稳定
G-estimation G-estimation 对某些假设稳健 实现复杂

G-formula 示例 (G-formula Example):

G-formula 步骤:

1. 拟合结局模型: E[Y|A, L]
2. 拟合协变量模型: E[Lₜ₊₁|Aₜ, Lₜ]
3. 蒙特卡洛模拟:
   - 设定处理方案 ā
   - 模拟协变量轨迹
   - 预测每个方案的结局
4. 比较不同方案的平均结局

10.4 本章小结 (Chapter Summary)

核心概念 (Core Concepts):

  1. 工具变量 (Instrumental Variables)
  2. 处理未观测混杂的方法
  3. 估计 LATE(依从者效应)
  4. 需要强工具变量

  5. 效应修饰 (Effect Modification)

  6. 真实生物学现象
  7. 需要分层报告
  8. 与混杂区分

  9. 因果交互 (Causal Interaction)

  10. 联合效应 vs 单独效应
  11. 协同 vs 拮抗
  12. 公共卫生意义

  13. 时变处理 (Time-Varying Treatments)

  14. 时变混杂挑战
  15. MSM 和 G 方法
  16. 纵向数据分析

关键术语表 (Glossary):

English 中文 定义
Instrumental variable 工具变量 处理未观测混杂的工具
LATE 局部平均处理效应 依从者的平均因果效应
Effect modification 效应修饰 效应在亚组间不同
Interaction 交互作用 联合效应偏离可加性
Time-varying treatment 时变处理 随时间变化的处理
MSM 边际结构模型 处理时变混杂的模型
IPTW 逆概率处理加权 MSM 的估计方法
G-methods G 方法 时变处理因果推断方法族
G-formula G 公式 基于模型标准化的方法
Complier 依从者 按工具变量分配接受处理者

📖 学习建议 (Study Recommendations)

理解检查 (Comprehension Check)

问题 1: 工具变量估计的是什么人群的效应?

点击查看答案 工具变量估计的是依从者 (compliers) 的局部平均处理效应 (LATE),而不是整个人群的平均处理效应 (ATE)。

问题 2: 效应修饰和混杂的区别是什么?

点击查看答案 效应修饰是真实现象需要描述,混杂是偏倚需要控制。效应修饰在分层后层间效应不同,混杂在分层后层间效应相同。

问题 3: 为什么时变处理需要特殊方法?

点击查看答案 因为时变混杂因素既是之前处理的后果,又是后续处理的混杂因素。标准回归调整会产生偏倚,需要使用 MSM 或 G-formula。

延伸阅读 (Further Reading)

  1. 工具变量:
  2. Angrist, J. D., & Pischke, J. S. (2009). Mostly Harmless Econometrics
  3. Baiocchi, M., Cheng, J., & Small, D. S. (2014). Instrumental variable methods for causal inference. Statistics in Medicine.

  4. 效应修饰与交互:

  5. VanderWeele, T. J., & Knol, M. J. (2014). A tutorial on interaction. Epidemiologic Methods.
  6. Rothman, K. J., Greenland, S., & Lash, T. L. (2008). Modern Epidemiology.

  7. 时变处理与 MSM:

  8. Robins, J. M., Hernán, M. A., & Brumback, B. (2000). Marginal structural models and causal inference in epidemiology. Epidemiology.
  9. Hernán, M. A., & Robins, J. M. (2006). Estimating causal effects from epidemiological data. JECH.

翻译完成时间: 2026-06-01
原书章节: Chapter 7-10
前续: 第 1-3 章, 第 4-6 章
后续: 第 11-15 章 (高级主题,待创建)


**Causal Inference: What If 中英对照 | 第 7-10 章** [返回顶部](#目录-table-of-contents)