Tech PostsTech Posts
인과 추론Causal Inference · 13 / 24
13 인과 추론Causal Inference

무작위 배정을 못 했을 때 남는 것What Is Left When You Could Not Randomise

처치는 이미 일어났고 동전 던지기로 배정되지 않았습니다. 이제 관측 데이터에서 반사실을 재구성해야 합니다.The treatment already happened and it was not assigned by coin flip. Now you have to reconstruct the counterfactual from observational data.

실험 섹션은 편한 상황에서 끝났습니다. 동전 던지기로 처치를 배정하면 평균 차이가 불편추정량입니다. 이 섹션은 그 밖의 모든 경우를 다룹니다. 처치는 이미 일어났고 아무도 무작위로 배정하지 않았고, 그래도 그것이 무엇을 했는지 말해야 하는 훨씬 흔한 경우입니다.

The experiments section ended in a comfortable situation: assign treatment by coin flip and the difference in means is unbiased. This section is about everything else — the far more common case where the treatment already happened, nobody randomised it, and you still have to say what it did.

잠재적 결과, 다시Potential outcomes, restated

각 단위에 잠재적 결과가 둘 있습니다. Y(0)과 Y(1) — 처치 없이, 처치와 함께 무슨 일이 일어나는가입니다. D는 어느 쪽을 관측하는지 나타내고 X는 공변량 벡터입니다. 관측되는 결과는 이렇게 씁니다.

Each unit has two potential outcomes, Y(0) and Y(1) — what would happen without and with treatment. D indicates which one you observe, X is a vector of covariates. The observed outcome is:

Y_i = (1 − D_i) · Y_i(0) + D_i · Y_i(1)
처치군에서는 Y(1)을, 나머지에서는 Y(0)을 보고, 누구에 대해서도 둘 다 보지는 못한다는 뜻입니다.You see Y(1) for the treated and Y(0) for everyone else, and never both for anyone.

이렇게 적어 두면 추정량보다 추정 대상을 먼저 말하게 됩니다. 그게 이 표기의 값어치입니다. "프로그램의 효과"는 모호하고 ATE·ATT·ATC는 그렇지 않습니다.

The value of writing it this way is that it forces the estimand to be stated before the estimator. "Effect of the programme" is ambiguous; ATE, ATT and ATC are not.

추정 대상무엇의 평균인가답하는 질문
ATE전체모집단 전체를 처치하면 어떻게 되는가
ATT처치받은 사람들이 프로그램은 참여자에게 값어치가 있었는가
ATC처치받지 않은 사람들아직 닿지 않은 사람들에게 확대해야 하는가
EstimandAveraged overThe question it answers
ATEeveryoneWhat if we treated the whole population?
ATTthe treated onlyWas this worth running for the people who took it?
ATCthe untreatedShould we expand to the people we have not reached?

작동시키는 두 가정The two assumptions that make it work

관측 데이터 추정은 처치가 강하게 무시 가능할 때 성립합니다. 두 조건이 함께 성립해야 한다는 뜻입니다.

Observational estimation works in settings where treatment is strongly ignorable, which means two conditions hold together.

비교란성Unconfoundedness

X를 조건으로 두면 처치 배정이 잠재적 결과와 독립입니다. 쉽게 말하면 관측된 공변량에서 똑같아 보이는 단위들 사이에서는 누가 처치받았는지가 무작위나 다름없습니다.

Conditional on X, treatment assignment is independent of the potential outcomes. Informally: among units that look identical on the observed covariates, who got treated is as good as random.

강하고 근본적으로 검정 불가능한 가정입니다. 어떤 진단도 이것이 성립하는지 말해 주지 않습니다. 관측되지 않은 변수에 대한 진술이기 때문입니다. 관측할 수 있었다면 조건으로 넣었겠죠. 유일한 방어는 주제 지식입니다. 처치 선택과 결과 양쪽을 움직이는 모든 것을 측정했다고 논증할 수 있어야 합니다. 누군가 "관측 가능한 것들을 통제했다"고 말할 때 기대고 있는 가정이 이것이고 대개 받는 것보다 더 많은 검토를 받아야 마땅합니다.

This is a strong and fundamentally untestable assumption. No diagnostic tells you it holds, because it is a statement about unobserved variables — if you could observe them you would condition on them. The only defence is subject knowledge: you must be able to argue you have measured everything that drives both selection into treatment and the outcome. Whenever someone says "we controlled for observables", this is the assumption they are relying on, and it deserves more scrutiny than it usually gets.

중첩Overlap

X의 모든 값에서 처치 확률이 0과 1 사이에 엄격히 있습니다. 모든 공변량 조합에 처치군과 비처치군이 둘 다 있어야 합니다.

For every value of X, the probability of treatment is strictly between 0 and 1. There must be both treated and untreated units at every covariate profile.

python
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LogisticRegression

rng = np.random.default_rng(9)
n = 4_000
age = rng.normal(45, 12, n)

# selection into treatment depends strongly on age -> weak overlap in the tails
logit = -6 + 0.12 * age
treated = rng.binomial(1, 1 / (1 + np.exp(-logit)))

ps = LogisticRegression().fit(age.reshape(-1, 1), treated).predict_proba(
    age.reshape(-1, 1))[:, 1]

plt.hist(ps[treated == 1], bins=40, alpha=0.6, label="treated", density=True)
plt.hist(ps[treated == 0], bins=40, alpha=0.6, label="control", density=True)
plt.xlabel("estimated propensity score"); plt.legend()

for lo, hi in [(0.0, 0.1), (0.9, 1.0)]:
    region = (ps >= lo) & (ps < hi)
    print(f"ps in [{lo},{hi}): {treated[region].sum():>4} treated, "
          f"{(1-treated[region]).sum():>4} control")
이 그림이 진단입니다. 두 분포가 거의 겹치지 않으면 비교군이 없는 것입니다.This plot is the diagnostic. If the two distributions barely intersect, there is no comparison group.
ps in [0.0,0.1):    1 treated,  418 control
ps in [0.9,1.0):  356 treated,    3 control

양쪽 끝에서 비교 상대가 사실상 없습니다. 그 영역의 처치효과 추정치는 데이터가 아니라 함수 형태가 만들어 낸 것입니다.

At both extremes there is effectively no comparison. Any treatment effect estimated in those regions is manufactured by the functional form, not by the data.

성향점수가 중요한 이유Why the propensity score matters

고차원 X를 직접 조건으로 두는 건 실행 불가능합니다. 공변량이 20개면 정확히 일치하는 짝이 사실상 없습니다. Rosenbaum과 Rubin의 1983년 결과가 우회로입니다. 처치가 X를 조건으로 비교란이면 스칼라 하나인 성향점수 P(D = 1 | X)를 조건으로 해도 비교란입니다.

Conditioning on a high-dimensional X directly is infeasible — with twenty covariates there are essentially no exact matches. Rosenbaum and Rubin 1983 result is the way around it: if treatment is unconfounded given X, it is also unconfounded given the single scalar propensity score P(D = 1 | X).

20차원 매칭 문제가 1차원으로 접힙니다. 성향점수 매칭·가중·층화의 이론적 토대이고 읽게 될 거의 모든 관측 연구에 이 점수가 나오는 이유입니다.

That collapses a matching problem in twenty dimensions into one dimension. It is the theoretical foundation for propensity score matching, weighting and stratification, and why the score appears in nearly every observational study you will read.

따라오는 주의 두 가지. 성향점수는 추정되어야 하고 그 추정 오차가 처치효과로 전파됩니다. 순진한 2단계의 표준오차는 이것을 반영하지 않습니다. 그리고 성향 모형이 잘 맞는 것이 목표가 아닙니다. 처치를 완벽히 예측하는 점수는 중첩이 없다는 뜻이고 그러면 아무것도 추정하지 못합니다. 기준은 예측 정확도가 아니라 공변량 균형입니다.

Two cautions come with it. The propensity score must be estimated, and errors in that estimation propagate into the treatment effect — naive second-stage standard errors do not account for this. And a well-fitting propensity model is not the goal: a score that predicts treatment perfectly means there is no overlap and nothing can be estimated. Balance on covariates, not predictive accuracy, is the criterion.

실무에서In practice

  • 무엇보다 먼저 중첩을 확인하십시오. 처치군과 대조군의 성향점수 분포를 따로 그리십시오. 거의 겹치지 않으면 멈추고 설계를 다시 생각하십시오. 공통 지지 영역으로 잘라 내는 건 표준이지만 명시하십시오. 자르면 추정 대상이 바뀝니다. 이제 전체가 아니라 비교 가능한 부분모집단에 대한 효과를 추정합니다.
  • 성향 모형은 적합도가 아니라 균형으로 판단하십시오. 매칭이나 가중 후 표준화 차이로 공변량 평균을 비교하십시오. 0.1 아래가 통상적 목표입니다. 여기에 t검정을 쓰지 마십시오. 실험 편과 같은 이유로, 매칭 후 표본 크기가 달라져 p값이 균형과 검정력을 뒤섞습니다.
  • 올바른 변수를 넣으십시오. 처치와 결과 양쪽에 영향을 주는 것은 전부 X에 있어야 합니다. 처치에는 영향을 주지만 결과에는 아닌 변수는 오히려 해롭습니다. 편향을 줄이지 않으면서 중첩만 깎습니다. 그리고 처치 이후 변수는 절대 넣지 마십시오. 공변량 조정 편에서 다룬 충돌부 문제입니다.
  • 민감도 분석은 선택이 아닙니다. 비교란성을 검정할 수 없으니 결과를 뒤집으려면 그 가정이 얼마나 심하게 깨져야 하는지를 수량화하십시오. Rosenbaum 경계와 E-value가 둘 다 이 일을 합니다. 약한 미관측 교란변수에 뒤집히는 결과는 그렇다고 보고해야 합니다. 가정을 통째로 무시한 좁은 표준오차보다 훨씬 정직한 제시입니다.
  • 다른 걸 잡아야 할 때를 아십시오. 관측 가능한 것에 의한 선택은 이 섹션의 전략 중 가장 약합니다. 모든 교란변수를 측정했어야 하기 때문입니다. 그럴듯한 도구변수나 불연속이나 사전/사후 비교가 있다면 그 설계는 방어하기 훨씬 쉬운 가정 위에 섭니다. 다음 세 편이 그것입니다.
  • Check overlap before anything else. Plot the estimated propensity score separately for treated and control units. If the distributions barely intersect, stop and reconsider the design. Trimming to the common support region is standard, but be explicit: trimming changes your estimand, because you are now estimating an effect for the comparable subpopulation rather than for everyone.
  • Judge the propensity model by balance, not by fit. After matching or weighting, compare covariate means using standardised differences; under 0.1 is the usual target. Do not use t-tests, for the same reason as in the experiments post: the sample size after matching differs, so p-values conflate balance with power.
  • Include the right variables. Anything affecting both treatment and outcome must be in X. Variables that affect treatment but not outcome are actively harmful — they reduce overlap without reducing bias. And never include post-treatment variables, for the collider reasons in the covariate adjustment post.
  • Sensitivity analysis is not optional. Since unconfoundedness cannot be tested, quantify how badly it would have to fail to overturn your result. Rosenbaum bounds and the E-value both do this. A result that flips under a mild unobserved confounder should be reported as such — far more honest than a point estimate with a tight standard error that ignores the assumption entirely.
  • Know when to reach for something else. Selection on observables is the weakest of the strategies in this section, because it requires having measured every confounder. If a plausible instrument, a discontinuity, or a pre/post comparison across groups is available, those designs rest on assumptions that are easier to defend. That is what the next three posts cover.