Consider the following model (DAG), where D
is the treatment (exposure) and Y1
is the outcome. To estimate the causal effect of D
on Y1
, we can simply condition on V
and Y0
(ignoring E
).
My issue is that a simple OLS model recover the true model, but when I try to use matching it fails. Why?
Below I simulate the model.
library(tidyverse)
library("MatchIt")
library("optmatch")
library("Matching")
set.seed(123)
N = 5000
E0 = rnorm(N, 0, 1)
V = rnorm(N, 0, 2)
Y0 = E0*3 + rnorm(N, 0, 2)
D = Y0*5 + (-2*E0) + V*3 + rnorm(N, 0, 5)
# create binary treatment #
Dbin = rbinom(N, 1, plogis(D))
# outcome
Y1 = Y0*6 + (-10*Dbin) + V*2 + rnorm(N, 0, 10)
# put into a dataframe
df = data.frame(E0, Y0, V, D, Dbin, Y1)
# correct model #
# D = -10, causal effect should be approx. -10
Using a simple OLS regression, we recover the true effect of D
, which I set to -10
lm(Y1 ~ Dbin + Y0 + V, data = df) %>% summary()
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.26253 0.26069 1.007 0.314
Dbin -10.38234 0.43763 -23.724 <2e-16 ***
However, now when I try a Propensity Score Matching (or even other types of matching), I never get to retrieve the true effect.
Here I use the variables Y0
and V
because they should be sufficient (using E
does not change the estimation).
# Estimate the propensity model
glm1 <- glm(Dbin ~ Y0 + V, family=binomial, data=df)
X <- glm1$fitted
Y <- df$Y1
Tr <- df$Dbin
rr <- Match(Y=Y, Tr=Tr, X=X, M=1, estimand = "ATT");
I get an ATT of -7, and an ATE of -5!
When I try other matching methods, I also get weird results.
m1 = matchit(Dbin ~ Y0 + V + E0, df, distance = 'mahalanobis', method = 'full')
mat1 = match.data(m1)
lm(Y1 ~ Dbin, mat1, weights = weights) %>% summary()
What am I doing wrong?