Skip to contents

`catt_gt_discrete` computes doubly robust uniform confidence bands for the group-time conditional average treatment (CATT) function given a discrete pre-treatment covariate in the staggered difference-in-differences setup of Callaway and Sant'Anna (2021). See Imai, Qin, and Yanagi (2023) for details.

Usage

catt_gt_discrete(
  yname,
  tname,
  idname,
  gname,
  zname,
  xformla,
  data,
  zeval,
  gteval = NULL,
  control_group = "nevertreated",
  anticipation = 0,
  alp = 0.05,
  biters = 1000,
  uniformall = FALSE,
  cores = 1
)

Arguments

yname

The name of the outcome

tname

The name of the time periods

idname

The name of the cross-sectional IDs

gname

The name of the groups. "G = 0" indicates the never treated group.

zname

The name of the scalar discrete covariate for which the group-time conditional average treatment effects are estimated

xformla

A formula for the covariates to include in the model. It should be of the form `~ X1 + X2`. `xformla` should include `zname` as a covariate.

data

The name of data.frame that contains the balanced panel data

zeval

The vector of the evaluation points z

gteval

The vector or matrix of the evaluation points g and t. If it is a vector, the first and second elements indicate g and t, respectively. If it is a matrix, the first and second columns indicate g's and t's, respectively. Default is `NULL`, and `gteval` is automatically constructed.

control_group

Which units to use the control group. Options are "nevertreated" and "notyettreated". Default is "nevertreated".

anticipation

The number of time periods before participating in the treatment where units can anticipate participating in the treatment and therefore it can affect their untreated potential outcomes. Default is 0.

alp

The significance level. Default is 0.05.

biters

The number of bootstrap iterations to use. Default is 1000.

uniformall

Boolean for whether or not to perform the uniform inference over (g, t, z). Default is `FALSE`, and the uniform inference only over z is performed.

cores

The number of cores to use for parallel processing. The number of available cores can be checked with parallel::detectCores(). Default is 1.

Value

A list that contains the following elements:

Estimate

A data.frame that contains the following elements:
g: The group.
t: The period.
z: The covariate value.
est: The doubly robust estimate of CATT.
se: The standard error.
ci_lower: The lower bound of the UCB via multiplier bootstrapping.
ci_upper: The upper bound of the UCB via multiplier bootstrapping.

Figure

A list that contains the ggplot elements for the UCB

References

Callaway, B., & Sant’Anna, P. H. (2021). Difference-in-differences with multiple time periods. Journal of Econometrics, 225(2), 200-230.

Imai, S., Qin, L., & Yanagi, T. (2023). Doubly Robust Uniform Confidence Bands for Group-Time Conditional Average Treatment Effects in Difference-in-Differences. arXiv preprint arXiv:2305.02185.

Examples

if (FALSE) {
set.seed(1)
data <- datageneration(n = 1000, tau = 4, continuous = FALSE)
est <- catt_gt_discrete(yname = "Y",
                        tname = "period",
                        idname = "id",
                        gname = "G",
                        zname = "Z",
                        xformla = ~ Z,
                        data = data,
                        zeval = c(-1, 0, 1),
                        gteval = c(2, 2),
                        control_group = "nevertreated",
                        anticipation = 0,
                        alp = 0.05,
                        biters = 1000,
                        uniformall = FALSE,
                        cores = 1)
}