Difference-in-differences based on inverse probability weighting
Difference-in-differences based on inverse probability weighting
Difference-in-differences-based estimation of the average treatment effect on the treated in the post-treatment period, given a binary treatment with one pre- and one post-treatment period. Permits controlling for differences in observed covariates across treatment groups and/or time periods based on inverse probability weighting.
didweight(y, d, t, x =NULL, boot =1999, trim =0.05, cluster =NULL)
Arguments
y: Dependent variable, must not contain missings.
d: Treatment, must be binary (either 1 or 0), must not contain missings.
t: Time period, must be binary, 0 for pre-treatment and 1 for post-treatment, must not contain missings.
x: Covariates to be controlled for by inverse probability weighting. Default is NULL.
boot: Number of bootstrap replications for estimating standard errors. Default is 1999.
trim: Trimming rule for discarding observations with extreme propensity scores in the 3 reweighting steps, which reweight (1) treated in the pre-treatment period, (2) non-treated in the post-treatment period, and (3) non-treated in the pre-treatment period according to the covariate distribution of the treated in the post-treatment period. Default is 0.05, implying that observations with a probability lower than 5 percent of not being treated in some weighting step are discarded.
cluster: A cluster ID for block or cluster bootstrapping when units are clustered rather than iid. Must be numerical. Default is NULL (standard bootstrap without clustering).
Returns
A didweight object contains 4 components, eff, se, pvalue, and ntrimmed.
eff: estimate of the average treatment effect on the treated in the post-treatment period.
se: standard error obtained by bootstrapping the effect.
pvalue: p-value based on the t-statistic.
ntrimmed: total number of discarded (trimmed) observations in any of the 3 reweighting steps due to extreme propensity score values.
Details
Estimation of the average treatment effect on the treated in the post-treatment period based Difference-in-differences. Inverse probability weighting is used to control for differences in covariates across treatment groups and/or over time. That is, (1) treated observations in the pre-treatment period, (2) non-treated observations in the post-treatment period, and (3) non-treated observations in the pre-treatment period are reweighted according to the covariate distribution of the treated observations in the post-treatment period. The respective propensity scores are obtained by probit regressions.
Examples
# A little example with simulated data (4000 observations)## Not run:n=4000# sample sizet=1*(rnorm(n)>0)# time periodu=rnorm(n)# time constant unobservablex=0.5*t+rnorm(n)# time varying covariated=1*(x+u+rnorm(n)>0)# treatmenty=d*t+t+x+u+rnorm(n)# outcome# The true effect equals 1didweight(y=y,d=d,t=t,x=x, boot=199)## End(Not run)
References
Abadie, A. (2005): "Semiparametric Difference-in-Differences Estimators", The Review of Economic Studies, 72, 1-19.
Lechner, M. (2011): "The Estimation of Causal Effects by Difference-in-Difference Methods", Foundations and Trends in Econometrics, 4, 165-224.