4 Propensity Score Matching
4.1 Supuestos de identificación
Para estimar un efecto causal cuando hay un factor de confusión, necesitamos (1) supuesto de independencia condicional -CIA y (2) que la probabilidad de tratamiento esté entre 0 y 1 para cada estrato. Más formalmente,
\((Y^1,Y^0) \perp \!\!\! \perp D\mid X\) (independencia condicional)
\(0<Pr(D=1 \mid X) <1\) con probabilidad 1 (soporte común)
Estos dos supuestos producen la siguiente identidad:
\[ \begin{align} E\big[Y^1-Y^0\mid X\big] & = E\big[Y^1 - Y^0 \mid X,D=1\big] \\ & = E\big[Y^1\mid X,D=1\big] - E\big[Y^0\mid X,D=0\big] \\ & = E\big[Y\mid X,D=1\big] - E\big[Y\mid X,D=0\big] \end{align} \]
donde cada valor de \(Y\) está determinado por la ecuación de conmutación. Dado el soporte común, obtenemos el siguiente estimador:
\[ \begin{align} \widehat{\delta_{ATE}}= \int \Big(E\big[Y\mid X,D=1\big] - E\big[Y\mid X,D=0\big]\Big)d\Pr(X) \end{align} \]
Por un lado, necesitamos que el tratamiento sea condicionalmente independiente de ambos resultados potenciales para identificar el ATE, pero solo necesitamos que el tratamiento sea condicionalmente independiente de \(Y_0\) para identificar el ATT y el hecho de que existen algunas unidades en el grupo de control para cada estrato de tratamiento.
4.2 Vecinos más cercanos
Comenzamos con la medida de distancia más simple, la distancia euclidiana (normalizada):
\[ ||X_i-X_j||=\sqrt{(X_i-X_j)'\widehat{V}^{-1}(X_i-X_j)} \]
donde
\[ \widehat{V}^{-1} = \begin{pmatrix} \widehat{\sigma}_1^2 & 0 & \dots & 0 \\ 0 & \widehat{\sigma}_2^2 & \dots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \dots & \widehat{\sigma}_k^2 \\ \end{pmatrix} \]
La distancia de Mahalanobis se define por:
\[ ||X_i-X_j||=\sqrt{ (X_i-X_j)'\widehat{\Sigma}_X^{-1}(X_i - X_j) } \]
donde \(\widehat{\Sigma}_X\) es la matriz de varianza-covarianza muestral de \(X\).
Cuanto mayor sea la dimensión, mayor será la probabilidad de discrepancias en el emarejamientom y más datos se necesitarán.
4.3 Métodos de propensión
El programa de capacitación laboral National Supported Work Demonstration (NSW) fue operado por Manpower Demonstration Research Corp (MRDC) a mediados de la década de 1970.
El NSW fue un programa de empleo temporal diseñado para ayudar a los trabajadores desfavorecidos que carecen de habilidades laborales básicas a ingresar al mercado laboral brindándoles experiencia laboral y asesoramiento en un entorno protegido.
También fue único en el sentido de que asignó al azar a candidatos calificados a puestos de capacitación. El grupo de tratamiento recibió todos los beneficios del programa NSW. Básicamente, se dejó que los controles se las arreglaran solos.
Ejemplo
Leemos los datos y limpiamos:
uu <- "https://raw.github.com/scunning1975/mixtape/master/nsw_mixtape.dta"
nsw_dw <- data.frame(haven::read_dta(uu))
uu <- "https://raw.github.com/scunning1975/mixtape/master/cps_mixtape.dta"
nsw_dw_cpscontrol <- data.frame(haven::read_dta(uu)%>%
bind_rows(nsw_dw))
nsw_dw_cpscontrol$agesq <- nsw_dw_cpscontrol$age^2
nsw_dw_cpscontrol$agecube <- nsw_dw_cpscontrol$age^3
nsw_dw_cpscontrol$educsq <- nsw_dw_cpscontrol$educ^2
nsw_dw_cpscontrol$u74 <- (nsw_dw_cpscontrol$re74==0)*1
nsw_dw_cpscontrol$u75 <- (nsw_dw_cpscontrol$re75==0)*1
nsw_dw_cpscontrol$interaction1 <- nsw_dw_cpscontrol$educ*nsw_dw_cpscontrol$re74
nsw_dw_cpscontrol$re74sq <- nsw_dw_cpscontrol$re74^2
nsw_dw_cpscontrol$re75sq <- nsw_dw_cpscontrol$re75^2
nsw_dw_cpscontrol$interaction2 <- nsw_dw_cpscontrol$u74*nsw_dw_cpscontrol$hisp
table(nsw_dw_cpscontrol$u74)
##
## 0 1
## 14198 2239
##
## FALSE TRUE
## 14198 2239
Ajustamos el modelo sin tomar en cuenta el eparejamiento:
m1 <- lm(re78~treat,data = nsw_dw_cpscontrol)
m2 <- lm(re78~treat + age + agesq + agecube + educ +
educsq + marr + nodegree +
black + hisp + re74 + re75 + u74 + u75 + interaction1,data = nsw_dw_cpscontrol)
export_summs(m1,m2)
Model 1 | Model 2 | |
---|---|---|
(Intercept) | 14682.01 *** | 14127.56 *** |
(75.80) | (2141.49) | |
treat | -8332.87 *** | 1518.64 ** |
(714.47) | (546.37) | |
age | -860.53 *** | |
(186.37) | ||
agesq | 20.52 *** | |
(5.44) | ||
agecube | -0.17 *** | |
(0.05) | ||
educ | 31.86 | |
(100.01) | ||
educsq | 13.25 ** | |
(4.03) | ||
marr | 334.78 * | |
(149.87) | ||
nodegree | 121.15 | |
(181.56) | ||
black | -812.91 *** | |
(199.98) | ||
hisp | -215.07 | |
(217.87) | ||
re74 | 0.44 *** | |
(0.03) | ||
re75 | 0.45 *** | |
(0.01) | ||
u74 | 299.23 | |
(228.83) | ||
u75 | -1404.49 *** | |
(234.81) | ||
interaction1 | -0.01 *** | |
(0.00) | ||
N | 16437 | 16437 |
R2 | 0.01 | 0.48 |
*** p < 0.001; ** p < 0.01; * p < 0.05. |
Ahora ajustamos el PSM para encontrar un contrafactual adecuado:
library(MatchIt)
m_out <- matchit(treat ~ age + agesq + agecube + educ +
educsq + marr + nodegree +
black + hisp + re74 + re75 + u74 + u75 + interaction1,
data = nsw_dw_cpscontrol, method = "nearest",
distance = "logit", ratio =5)
m_data <- match.data(m_out)
summary(m_out)
##
## Call:
## matchit(formula = treat ~ age + agesq + agecube + educ + educsq +
## marr + nodegree + black + hisp + re74 + re75 + u74 + u75 +
## interaction1, data = nsw_dw_cpscontrol, method = "nearest",
## distance = "logit", ratio = 5)
##
## Summary of Balance for All Data:
## Means Treated Means Control Std. Mean Diff. Var. Ratio eCDF Mean eCDF Max
## distance 0.2218 0.0089 1.3346 13.6799 0.5030 0.8602
## age 25.8162 33.0945 -1.0172 0.4200 0.1830 0.3373
## agesq 717.3946 1217.1292 -1.1588 0.3031 0.1830 0.3373
## agecube 21554.6595 48835.9567 -1.3013 0.2169 0.1830 0.3373
## educ 10.3459 11.9965 -0.8209 0.4924 0.0891 0.4037
## educsq 111.0595 152.1260 -1.0448 0.3440 0.0891 0.4037
## marr 0.1892 0.7028 -1.3114 . 0.5136 0.5136
## nodegree 0.7081 0.3045 0.8879 . 0.4037 0.4037
## black 0.8432 0.0856 2.0839 . 0.7577 0.7577
## hisp 0.0595 0.0726 -0.0556 . 0.0131 0.0131
## re74 2095.5737 13826.2674 -2.4006 0.2571 0.4522 0.5933
## re75 1532.0553 13452.6856 -3.7029 0.1189 0.4682 0.6407
## u74 0.7081 0.1297 1.2722 . 0.5784 0.5784
## u75 0.6000 0.1185 0.9828 . 0.4815 0.4815
## interaction1 22898.7265 168746.6504 -2.5412 0.1957 0.4377 0.6024
##
## Summary of Balance for Matched Data:
## Means Treated Means Control Std. Mean Diff. Var. Ratio eCDF Mean eCDF Max
## distance 0.2218 0.1279 0.5890 1.4532 0.0121 0.3492
## age 25.8162 25.7027 0.0159 0.7370 0.0299 0.0876
## agesq 717.3946 730.0205 -0.0293 0.6886 0.0299 0.0876
## agecube 21554.6595 23021.8022 -0.0700 0.6062 0.0299 0.0876
## educ 10.3459 10.5989 -0.1258 0.8110 0.0179 0.0941
## educsq 111.0595 117.3168 -0.1592 0.7814 0.0179 0.0941
## marr 0.1892 0.2800 -0.2319 . 0.0908 0.0908
## nodegree 0.7081 0.6141 0.2069 . 0.0941 0.0941
## black 0.8432 0.7643 0.2171 . 0.0789 0.0789
## hisp 0.0595 0.1503 -0.3840 . 0.0908 0.0908
## re74 2095.5737 3419.2548 -0.2709 0.7707 0.0532 0.2022
## re75 1532.0553 2419.0200 -0.2755 0.7167 0.0382 0.1514
## u74 0.7081 0.5059 0.4447 . 0.2022 0.2022
## u75 0.6000 0.4486 0.3089 . 0.1514 0.1514
## interaction1 22898.7265 37412.0453 -0.2529 0.8660 0.0551 0.2022
## Std. Pair Dist.
## distance 0.5922
## age 1.0729
## agesq 1.0171
## agecube 0.9572
## educ 1.0700
## educsq 1.1015
## marr 0.8502
## nodegree 0.9203
## black 0.5798
## hisp 0.8137
## re74 0.8555
## re75 0.8697
## u74 0.9250
## u75 0.9048
## interaction1 0.8075
##
## Sample Sizes:
## Control Treated
## All 16252 185
## Matched 925 185
## Unmatched 15327 0
## Discarded 0 0
Ajustamos el modelo LM con el contrafactual encontrado:
m3 <- lm(re78~treat ,data = m_data)
m4 <- lm(re78~treat + age + agesq + agecube + educ +
educsq + marr + nodegree +
black + hisp + re74 + re75 + u74 + u75 + interaction1,data = m_data)
export_summs(m1,m2,m3,m4)
Model 1 | Model 2 | Model 3 | Model 4 | |
---|---|---|---|---|
(Intercept) | 14682.01 *** | 14127.56 *** | 5983.03 *** | 5599.67 |
(75.80) | (2141.49) | (227.28) | (7266.98) | |
treat | -8332.87 *** | 1518.64 ** | 366.12 | 1200.16 * |
(714.47) | (546.37) | (556.71) | (534.54) | |
age | -860.53 *** | -211.63 | ||
(186.37) | (682.51) | |||
agesq | 20.52 *** | 7.71 | ||
(5.44) | (21.82) | |||
agecube | -0.17 *** | -0.09 | ||
(0.05) | (0.22) | |||
educ | 31.86 | 234.94 | ||
(100.01) | (435.91) | |||
educsq | 13.25 ** | 0.04 | ||
(4.03) | (23.73) | |||
marr | 334.78 * | -1037.26 * | ||
(149.87) | (490.81) | |||
nodegree | 121.15 | 125.77 | ||
(181.56) | (630.21) | |||
black | -812.91 *** | -1607.36 * | ||
(199.98) | (703.22) | |||
hisp | -215.07 | 424.49 | ||
(217.87) | (858.94) | |||
re74 | 0.44 *** | -0.05 | ||
(0.03) | (0.19) | |||
re75 | 0.45 *** | 0.35 *** | ||
(0.01) | (0.08) | |||
u74 | 299.23 | 69.52 | ||
(228.83) | (577.42) | |||
u75 | -1404.49 *** | -912.35 | ||
(234.81) | (549.54) | |||
interaction1 | -0.01 *** | 0.03 | ||
(0.00) | (0.02) | |||
N | 16437 | 16437 | 1110 | 1110 |
R2 | 0.01 | 0.48 | 0.00 | 0.15 |
*** p < 0.001; ** p < 0.01; * p < 0.05. |