---
title: "【AI 核心深度 M1-058】解释倾向得分匹配（PSM）与逆概率加权（IPW）。（Explain Propensity Score Matching (PSM) and Inverse Probability Weighting (IPW) for Observational Causal Inference）深度数理推导与工程落地解析"
canonical_url: "https://airsota.com/2026/10/01/science-depth-m1-058-causal-inference/"
date_published: "2026-10-01T08:03:03-07:00"
date_modified: "2026-10-01T08:03:03-07:00"
language: "zh-CN"
categories: ["AI 核心深度 856 题 (Science Depth)", "TalentMe (AI 学习与算法架构)", "大厂算法与面试备考 (Interview Guides &amp; Math)"]
tags: ["applied-scientist", "causal-inference", "machine-learning", "module-m1", "science-depth"]
summary: "PSM 用倾向得分匹配相似样本；IPW 用 1/倾向得分重加权，构造伪随机化总体。"
publisher: "AirSOTA (https://airsota.com)"
---

# 【AI 核心深度 M1-058】解释倾向得分匹配（PSM）与逆概率加权（IPW）。（Explain Propensity Score Matching (PSM) and Inverse Probability Weighting (IPW) for Observational Causal Inference）深度数理推导与工程落地解析

> **Executive Summary**: PSM 用倾向得分匹配相似样本；IPW 用 1/倾向得分重加权，构造伪随机化总体。

> 
**所属模块**：`M1 · 数学与统计基础 (Mathematics & Statistics Fundamentals)` | **专题分类**：`因果推断 (Causal Inference)` | **难度等级**：`Medium`

### 一、核心一句话结论 (One-Sentence Summary)

**PSM 用倾向得分匹配相似样本；IPW 用 1/倾向得分重加权，构造伪随机化总体。**

*The propensity score $e(X) = P(T=1mid X)$ condenses high-dimensional confounders into a scalar; PSM matches treated and control units with identical scores, while IPW weights units by $1/e(X)$ to create a synthetic pseudo-randomized population.*

### 二、核心考点要义 (Key Insights)

- 📌 倾向得分 e(X)=P(T=1|X)

- 📌 重叠性假设：0<e(X)<1

- 📌 IPW 对倾向得分模型误设敏感

**English Insights:**

- *Propensity Score: By Rosenbaum & Rubin (1983), conditioning on scalar $e(X)$ achieves conditional independence: $(Y(0), Y(1)) perp T mid e(X)$.*

- *Propensity Score Matching (PSM): Pairs each treated unit with one or more nearest-neighbor control units having similar $e(X)$.*

- *Inverse Probability Weighting (IPW): Weights treated units by $frac{1}{e(X)}$ and control units by $frac{1}{1 - e(X)}$; Horvitz-Thompson estimator.*

- *Positivity Assumption: $0 < e(X) < 1$ for all $X$; every unit must have non-zero probability of receiving either treatment.*

### 三、核心数学原理与机理推导 (Mathematical Principles & Derivation)

$$mathrm{IPW}: hattau=frac1nsumBig[frac{T_iY_i}{e(X_i)}-frac{(1-T_i)Y_i}{1-e(X_i)}Big]$$

**倾向得分** e(X)=P(T=1|X) 是'在给定协变量下接受处理的概率'，它把高维协变量压缩为一维——这是 Rosenbaum & Rubin (1983) 的核心定理：若控制 X 后处理可忽略，则控制 e(X) 同样可忽略。**PSM** 通过匹配倾向得分相近的处理/对照个体来构造可比组，直观但丢弃未匹配样本且匹配质量难控。**IPW** 的思路完全不同：给每个观测赋予权重 1/e(X)（处理组）或 1/(1−e(X))（对照组），使得加权后的样本在协变量分布上**模拟随机化**——直觉是'倾向得分低却接受了处理的人代表了很多没被处理的人，故应放大其权重'。IPW 估计量可写为加权均值差，且有两组正确性条件：倾向得分模型正确，或结果模型正确（后者对应 DR）。

  📖 查看英文严格数学推导 (English Mathematical Derivation)

Proof of balancing score property: $P(T=1 mid X, e(X)) = P(T=1mid X) = e(X)$. Thus, $T$ and $X$ are conditionally independent given $e(X)$. For IPW Horvitz-Thompson estimator: $hat{mu}_1 = Eleft[frac{T Y}{e(X)}right] = E_Xleft[Eleft[frac{T Y(1)}{e(X)} mid Xright]right] = E_Xleft[frac{E[Tmid X] E[Y(1)mid X]}{e(X)}right] = E_Xleft[frac{e(X) E[Y(1)mid X]}{e(X)}right] = E_X[E[Y(1)mid X]] = E[Y(1)]$. Similarly, $Eleft[frac{(1-T)Y}{1-e(X)}right] = E[Y(0)]$. The IPW ATE estimator is $hat{tau}_{text{IPW}} = frac{1}{N}sum_{i=1}^N left( frac{T_i Y_i}{e(X_i)} - frac{(1-T_i)Y_i}{1-e(X_i)} right)$.

  

### 四、工业级落地权衡与工程考量 (Industrial Trade-offs)

实践要点：① **假设与诊断**——需满足**条件可忽略性**（无未观测混淆，不可检验）、**重叠性/正性**（0<e(X)<1，即每个个体都有机会接受两种处理）、**SUTVA**。诊断手段：检查倾向得分的重叠区域（画两组的 e(X) 分布）、用标准化偏差（standardized bias）检查加权/匹配后的协变量平衡、检查有效样本量（ESS）。② **IPW 的方差问题**——权重可能极大（当 e(X)→0 或 1 时），导致方差爆炸；缓解手段是**稳定化权重**（乘以边际处理概率，SNIPS）、**权重截断**（trimming，如限制到 99 分位）、或用 **overlap weights**（一种自带降方差性质且不需截断的加权方案）。③ **PSM 的常见误用**——只匹配倾向得分而不检查协变量平衡、用匹配后样本直接做 t 检验（未考虑匹配的不确定性）、丢弃大量样本导致外部效度下降（估的是 ATT 而非 ATE）。④ **PSM vs IPW 选择**——IPW 用全部样本、理论基础更清晰（可推导渐近方差）、更易扩展（DR、TMLE），现代实践中更受推荐。

  ⚙️ 查看英文落地权衡分析 (English Systems & Trade-offs)

Comparison: (1) **PSM drawbacks**: Discards unmatched control units (reducing effective sample size), suffers from caliper tuning sensitivity, and cannot easily handle continuous treatments. (2) **IPW drawbacks**: Extreme propensity scores ($e(X)  0.99$) blow up weights, causing massive estimator variance. In practice, scientists use **Doubly Robust Estimators (AIPW)**, which combine propensity scores with outcome regression models; if EITHER model is correctly specified, the estimator remains consistent.

  

### 五、常见面试避坑陷阱 (Common Pitfalls & Traps)

- ⚠️ 只匹配倾向得分但不检查协变量平衡

- ⚠️ 忽视重叠性假设（e(X) 接近 0 或 1 时权重爆炸）

**English Pitfalls:**

- *Violating positivity (common support): Trying to match treated units in regions of feature space where zero control units ever exist.*

- *Unnormalized IPW weights creating massive variance spikes when propensity scores approach zero or one (mitigated by weight trimming / clipping).*

### 六、高频深度面试追问与预测 (Follow-Up Questions)

- **IPW 方差很大怎么办？（稳定化权重/trimming）**

- *How does the Augmented Inverse Probability Weighting (AIPW) estimator achieve double robustness?*

- **双重稳健（DR）为什么更稳？**

- *Why is covariate balance checking (standardized mean difference < 0.1) mandatory after propensity score matching?*

### 七、知识图谱对齐 (Knowledge Graph Anchor)

- 🔗 **关联底层卡片**：`因果推断框架：潜在结果模型、倾向评分匹配与双重差分` (`Causal Inference: Potential Outcomes, PSM & DiD`)

- 🗺️ **知识图谱模块**：`数据科学与因果实验导图`

  

#### 🔬 算法科学家与机器学习深度考察全量题库 (Science Depth)

  本题收录于 **TalentMe 算法科学家深度考察真题库 (Science Depth)**。全库共 856 道硬核考点，深度覆盖数学统计、经典ML、深度学习、Transformer、大语言模型、多模态、推荐系统与 MLOps。支持 Jev 面经智能匹配、一键离线单文件 HTML 手册导出并直连 Obsidian 本地记忆。

  [👉 前往 TalentMe 交互式研读本题 (M1-058) →](https://talentme.airsota.com/tools/science-depth/M1-058)

---
*Source: [AirSOTA Knowledge Matrix](https://airsota.com/2026/10/01/science-depth-m1-058-causal-inference/) · Complete Index: [llms.txt](https://airsota.com/llms.txt)*
