R/drdid_rc1.R
drdid_rc1.Rd
drdid_rc1
is used to compute the doubly robust estimators for the ATT
in difference-in-differences (DiD) setups with stationary repeated cross-sectional data. The resulting estimator is
not locally efficient; see Section 3.2 of Sant'Anna and Zhao (2020).
drdid_rc1(
y,
post,
D,
covariates,
i.weights = NULL,
boot = FALSE,
boot.type = "weighted",
nboot = NULL,
inffunc = FALSE
)
An \(n\) x \(1\) vector of outcomes from the both pre and post-treatment periods.
An \(n\) x \(1\) vector of Post-Treatment dummies (post = 1 if observation belongs to post-treatment period, and post = 0 if observation belongs to pre-treatment period.)
An \(n\) x \(1\) vector of Group indicators (=1 if observation is treated in the post-treatment, =0 otherwise).
An \(n\) x \(k\) matrix of covariates to be used in the propensity score and regression estimation. Please add a vector of constants if you want to include an intercept in the models. If covariates = NULL, this leads to an unconditional DiD estimator.
An \(n\) x \(1\) vector of weights to be used. If NULL, then every observation has the same weights. The weights are normalized and therefore enforced to have mean 1 across all observations.
Logical argument to whether bootstrap should be used for inference. Default is FALSE.
Type of bootstrap to be performed (not relevant if boot = FALSE
). Options are "weighted" and "multiplier".
If boot = TRUE
, default is "weighted".
Number of bootstrap repetitions (not relevant if boot = FALSE
). Default is 999.
Logical argument to whether influence function should be returned. Default is FALSE.
A list containing the following components:
The DR DiD point estimate
The DR DiD standard error
Estimate of the upper bound of a 95% CI for the ATT
Estimate of the lower bound of a 95% CI for the ATT
All Bootstrap draws of the ATT, in case bootstrap was used to conduct inference. Default is NULL
Estimate of the influence function. Default is NULL
The matched call.
Some arguments used (explicitly or not) in the call (panel = FALSE, estMethod = "trad2", boot, boot.type, nboot, type="dr")
The drdid_rc1
function implements the doubly robust difference-in-differences (DiD)
estimator for the average treatment effect on the treated (ATT) defined in equation (3.3)
in Sant'Anna and Zhao (2020). This estimator makes use of a logistic propensity score model for the probability
of being in the treated group, and of (separate) linear regression models for the outcome among the comparison units in both pre and
post-treatment time periods. Importantly, this estimator is not locally efficient for the ATT.
The propensity score parameters are estimated using maximum likelihood, and the outcome regression coefficients are estimated using ordinary least squares.
The resulting estimator is not not locally efficient; see Sant'Anna and Zhao (2020) for details.
Sant'Anna, Pedro H. C. and Zhao, Jun. (2020), "Doubly Robust Difference-in-Differences Estimators." Journal of Econometrics, Vol. 219 (1), pp. 101-122, doi:10.1016/j.jeconom.2020.06.003
# use the simulated data provided in the package
covX = as.matrix(cbind( 1, sim_rc[,5:8]))
# Implement the 'traditional' DR DiD estimator (not locally efficient!)
drdid_rc1(y = sim_rc$y, post = sim_rc$post, D = sim_rc$d,
covariates= covX)
#> Call:
#> drdid_rc1(y = sim_rc$y, post = sim_rc$post, D = sim_rc$d, covariates = covX)
#> ------------------------------------------------------------------
#> DR (but not locally efficient) DID estimator for the ATT:
#>
#> ATT Std. Error t value Pr(>|t|) [95% Conf. Interval]
#> -3.6334 3.1071 -1.1694 0.2422 -9.7234 2.4565
#> ------------------------------------------------------------------
#> Estimator based on (stationary) repeated cross-sections data.
#> Outcome regression est. method: OLS.
#> Propensity score est. method: maximum likelihood.
#> Analytical standard error.
#> ------------------------------------------------------------------
#> See Sant'Anna and Zhao (2020) for details.