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

drdid_imp_panel(
  y1,
  y0,
  D,
  covariates,
  i.weights = NULL,
  boot = FALSE,
  boot.type = "weighted",
  nboot = NULL,
  inffunc = FALSE,
  trim.level = 0.995
)

Arguments

y1

An \(n\) x \(1\) vector of outcomes from the post-treatment period.

y0

An \(n\) x \(1\) vector of outcomes from the 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. 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.

i.weights

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.

boot

Logical argument to whether bootstrap should be used for inference. Default is FALSE. Exactly zero centered bootstrap draws give a zero standard error and point interval. Nonfinite draws or a zero IQR with nonzero draws stop with an error.

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

A finite scalar integer of at least 2 giving the 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.

trim.level

The level of trimming for the propensity score. Default is 0.995.

Value

A list containing the following components:

ATT

The DiD point estimate.

se

The DiD standard error.

uci

The upper bound of the 95% CI for the ATT.

lci

The lower bound of the 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

Source of the verified IPT propensity-score fit: =0 for the trust candidate, =1 for the secondary IPT candidate. A candidate must satisfy the original exponential-IPT equations to numerical tolerance; optimizer status alone is insufficient.

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 = TRUE, estMethod = "imp", boot, boot.type, nboot, type="dr")

Details

Propensity-score fitting must satisfy the original exponential-IPT equations; numerically ill-conditioned designs are rejected. If neither fitting route provides a verified solution, estimation stops rather than substituting a logit MLE. To explicitly use the traditional estimator, call drdid_panel() (or drdid(..., estMethod = "trad")). This changes both propensity-score and outcome-regression fitting. Each weighted-bootstrap replicate must also have a verified IPT fit; a failed replicate stops the bootstrap without skipping or redrawing it.

The drdid_imp_panel 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.1) 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 a linear regression model for the outcome evolution among the comparison units.

The nuisance parameters (propensity score and outcome regression parameters) are estimated using the methods described in Sections 3.1 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.

Under the conditions in Sant'Anna and Zhao (2020), with trimming and propensity-score clipping inactive, the resulting estimator is locally efficient, doubly robust for the ATT, and doubly robust for inference. The weighted bootstrap refits the implemented point statistic. After active trimming or clipping, the IPT/WLS balance identities need not hold for the modified statistic; matching bootstrap refits alone does not establish these double-robustness or influence-function guarantees.

References

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

Examples

# Form the Lalonde sample with CPS comparison group
eval_lalonde_cps <- subset(nsw, nsw$treated == 0 | nsw$sample == 2)
# Further reduce sample to speed example
set.seed(123)
unit_random <- sample(1:nrow(eval_lalonde_cps), 5000)
eval_lalonde_cps <- eval_lalonde_cps[unit_random,]
# Select some covariates
covX = as.matrix(cbind(1, eval_lalonde_cps$age, eval_lalonde_cps$educ,
                             eval_lalonde_cps$black, eval_lalonde_cps$married,
                             eval_lalonde_cps$nodegree, eval_lalonde_cps$hisp,
                             eval_lalonde_cps$re74))

# Implement improved DR locally efficient DiD with panel data
drdid_imp_panel(y1 = eval_lalonde_cps$re78, y0 = eval_lalonde_cps$re75,
                D = eval_lalonde_cps$experimental,
                covariates = covX)
#>  Call:
#> drdid_imp_panel(y1 = eval_lalonde_cps$re78, y0 = eval_lalonde_cps$re75, 
#>     D = eval_lalonde_cps$experimental, covariates = covX)
#> ------------------------------------------------------------------
#>  Further improved locally efficient DR DID estimator for the ATT:
#>  
#>    ATT     Std. Error  t value    Pr(>|t|)  [95% Conf. Interval] 
#> -615.2344   683.1528   -0.9006     0.3678   -1954.2139  723.7452 
#> ------------------------------------------------------------------
#>  Estimator based on panel 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.