`R/drdid_imp_rc.R`

`drdid_imp_rc.Rd`

`drdid_imp_rc`

is used to compute the locally efficient doubly robust estimators for the ATT
in difference-in-differences (DiD) setups with stationary repeated cross-sectional data. The resulting estimator is
also doubly robust for inference; see Section 3.2 of Sant'Anna and Zhao (2020).

```
drdid_imp_rc(
y,
post,
D,
covariates,
i.weights = NULL,
boot = FALSE,
boot.type = "weighted",
nboot = NULL,
inffunc = FALSE
)
```

- y
An \(n\) x \(1\) vector of outcomes from the both pre and post-treatment periods.

- post
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.)

- D
An \(n\) x \(1\) vector of Group indicators (=1 if observation is treated in the post-treatment, =0 otherwise).

- covariates
An \(n\) x \(k\) matrix of covariates to be used in the propensity score and regression estimation. If covariates = NULL, this leads to an unconditional DID estimator.

- i.weights
An \(n\) x \(1\) vector of weights to be used. If NULL, then every observation has the same weights.

- boot
Logical argument to whether bootstrap should be used for inference. Default is FALSE.

- boot.type
Type of bootstrap to be performed (not relevant if

`boot = FALSE`

). Options are "weighted" and "multiplier". If`boot = TRUE`

, default is "weighted".- nboot
Number of bootstrap repetitions (not relevant if

`boot = FALSE`

). Default is 999.- inffunc
Logical argument to whether influence function should be returned. Default is FALSE.

A list containing the following components:

- ATT
The DR DID point estimate

- se
The DR DID standard error

- uci
Estimate of the upper bound of a 95% CI for the ATT

- lci
Estimate of the lower bound of a 95% CI for the ATT

- boots
All Bootstrap draws of the ATT, in case bootstrap was used to conduct inference. Default is NULL

- ps.flag
Convergence Flag for the propensity score estimation: =0 if

`trust`

algorithm converged, =1 if IPW algorithm converged (in case it was used), =2 if GLM logit estimator was used (i.e., if both`trust`

and IPT did not converged).- att.inf.func
Estimate of the influence function. Default is NULL

- call.param
The matched call.

- argu
Some arguments used (explicitly or not) in the call (panel = FALSE, estMethod = "imp", boot, boot.type, nboot, type="dr")

The `drdid_imp_rc`

function implements the locally efficient doubly robust difference-in-differences (DID)
estimator for the average treatment effect on the treated (ATT) defined in equation (3.4)
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 of both
treated and comparison units, in both pre and post-treatment periods.

The nuisance parameters (propensity score and outcome regression parameters) are estimated using the methods described in Sections 3.2 of Sant'Anna and Zhao (2020). In short, the propensity score parameters are estimated using the inverse probability tilting estimator proposed by Graham, Pinto and Pinto (2012), and the outcome regression coefficients are estimated using weighted least squares,where the weights depend on the propensity score estimates; see Sant'Anna and Zhao (2020) for details.

The resulting estimator is not only locally efficient and doubly robust for the ATT, but it is also doubly robust for inference; see Sant'Anna and Zhao (2020) for details.

Graham, Bryan, Pinto, Cristine, and Egel, Daniel (2012), "Inverse Probability Tilting for Moment Condition Models with Missing Data." Review of Economic Studies, vol. 79 (3), pp. 1053-1079, doi:10.1093/restud/rdr047

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
covX = as.matrix(sim_rc[,5:8])
# Implement the improved, locally efficient DR DID estimator
drdid_imp_rc(y = sim_rc$y, post = sim_rc$post, D = sim_rc$d,
covariates= covX)
#> Call:
#> drdid_imp_rc(y = sim_rc$y, post = sim_rc$post, D = sim_rc$d,
#> covariates = covX)
#> ------------------------------------------------------------------
#> Further improved locally efficient DR DID estimator for the ATT:
#>
#> ATT Std. Error t value Pr(>|t|) [95% Conf. Interval]
#> -0.2089 0.2003 -1.0425 0.2972 -0.6015 0.1838
#> ------------------------------------------------------------------
#> Estimator based on (stationary) repeated cross-sections data.
#> Outcome regression est. method: weighted least squares.
#> Propensity score est. method: inverse prob. tilting.
#> Analytical standard error.
#> ------------------------------------------------------------------
#> See Sant'Anna and Zhao (2020) for details.
```