Tae Hyun Kim (Lowell)

IPW (Inverse Propensity Weighting)

3분 읽기 #causal-inference#reweighting#ipw

정의

Propensity Score의 역수를 가중치로 사용하여 처치 효과 추정

ATE^IPW=1ni=1n[WiYie(Xi)(1Wi)Yi1e(Xi)]\hat{\text{ATE}}_{IPW} = \frac{1}{n}\sum_{i=1}^{n} \left[\frac{W_i Y_i}{e(X_i)} - \frac{(1-W_i) Y_i}{1-e(X_i)}\right]

여기서 e(X)=P(W=1X)e(X) = P(W=1 \mid X)Propensity Score.


직관적 이해

왜 역수 가중?

“과소 대표된 샘플에 더 큰 가중치”

상황처치 확률가중치의미
처치 희소e(X)=0.1e(X) = 0.11/0.1=101/0.1 = 10이 사람은 10명을 대표
처치 흔함e(X)=0.9e(X) = 0.91/0.91.11/0.9 ≈ 1.1거의 1:1 대표

재표본 관점

IPW는 다음과 동치:

  • 각 샘플을 가중치만큼 “복제”
  • 가상의 무작위 실험(pseudo-RCT) 생성

수학적 유도

ATE 식별

Strong Ignorability 하에서:

E[Y(w)]=E[1(W=w)YP(W=wX)]E[Y(w)] = E\left[\frac{\mathbb{1}(W=w) \cdot Y}{P(W=w \mid X)}\right]

따라서:

ATE=E[WYe(X)]E[(1W)Y1e(X)]\text{ATE} = E\left[\frac{WY}{e(X)}\right] - E\left[\frac{(1-W)Y}{1-e(X)}\right]

샘플 추정량

ATE^IPW=1ni[WiYie(Xi)(1Wi)Yi1e(Xi)]\hat{\text{ATE}}_{IPW} = \frac{1}{n}\sum_i \left[\frac{W_i Y_i}{e(X_i)} - \frac{(1-W_i) Y_i}{1-e(X_i)}\right]

정규화 버전

PS가 추정될 때 더 안정적:

ATE^IPWnorm=iWiYie(Xi)iWie(Xi)i(1Wi)Yi1e(Xi)i(1Wi)1e(Xi)\hat{\text{ATE}}_{IPW}^{norm} = \frac{\sum_i \frac{W_i Y_i}{e(X_i)}}{\sum_i \frac{W_i}{e(X_i)}} - \frac{\sum_i \frac{(1-W_i) Y_i}{1-e(X_i)}}{\sum_i \frac{(1-W_i)}{1-e(X_i)}}

장점: 편향 감소, 분산 감소


ATT를 위한 IPW

ATT^IPW=iWiYiiWii(1Wi)e(Xi)1e(Xi)Yii(1Wi)e(Xi)1e(Xi)\hat{\text{ATT}}_{IPW} = \frac{\sum_i W_i Y_i}{\sum_i W_i} - \frac{\sum_i (1-W_i) \frac{e(X_i)}{1-e(X_i)} Y_i}{\sum_i (1-W_i) \frac{e(X_i)}{1-e(X_i)}}

ATT 참조


장단점

장점

장점설명
간단직관적이고 구현 용이
비모수적Outcome 모델 가정 불필요
이론적 정당화조건부 일치성 보장
유연성다양한 estimand 적용 가능

단점

단점설명
PS 추정 의존PS 오특정 시 편향
극단적 PS 민감e(X)0e(X) \approx 0 또는 11에서 불안정
높은 분산특히 overlap 약할 때
고차원 어려움PS 추정 어려움

극단적 PS 문제

문제

e(X)0e(X) \to 0 또는 e(X)1e(X) \to 1일 때:

  • 가중치 폭발: 1/e(X)1/e(X) \to \infty
  • 추정량 불안정

해결책

  1. Trimming: 극단적 PS 샘플 제거
  2. Overlap Weighting: 안정적 가중치 사용
  3. Weight clipping: 가중치 상한 설정

구현

Python (EconML)

from econml.dr import LinearDRLearner

# IPW는 outcome model 없이
model = LinearDRLearner(model_propensity=LogisticRegression())
model.fit(Y, T, X)
ate = model.effect(X).mean()

R

library(WeightIt)

# Propensity score weights
weights <- weightit(treat ~ x1 + x2, data = df, method = "ps")

# Weighted outcome regression
lm(y ~ treat, data = df, weights = weights$weights)

관련 개념

  • Re-weighting Methods Overview - 재가중 방법 통합 정리
  • Propensity Score - 핵심 도구
  • Doubly Robust Estimator - IPW + Outcome regression
  • CBPS - 균형 직접 최적화
  • Trimming - 극단 PS 처리
  • Overlap Weighting - 안정적 가중치

응용: RTB Win Selection Bias 보정

RTB에서 낙찰된 impression만으로 학습 시 win selection bias 발생. IPW로 보정:

wi=1pwin(xi,bi),pwin=P(winX,bid)w_i = \frac{1}{p_{\text{win}}(x_i, b_i)}, \quad p_{\text{win}} = P(\text{win} \mid X, \text{bid})

Win propensity는 Survival Analysis (Kaplan-Meier) 또는 Gradient Boosting으로 추정. Weight stabilization (clipping, normalization)이 필수적. 자세한 내용은 Multi-Task Learning (IPW-ESCM²) 참조.


참고 논문

  • yaoSurveyCausalInference2021 - Section 3.1.3
  • Rosenbaum, P. R., & Rubin, D. B. (1983). The central role of the propensity score
  • Horvitz, D. G., & Thompson, D. J. (1952). A generalization of sampling without replacement
  • Zhang et al. (2016). Bid-aware Gradient Descent (KDD)

연결 그래프