Skip to contents

`catt_gt_continuous` computes doubly robust uniform confidence bands for the group-time conditional average treatment (CATT) function given a continuous 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_continuous(
  yname,
  tname,
  idname,
  gname,
  zname,
  xformla,
  data,
  zeval,
  gteval = NULL,
  control_group = "nevertreated",
  anticipation = 0,
  alp = 0.05,
  bstrap = TRUE,
  biters = 1000,
  porder = 2,
  kernel = "gau",
  bw = NULL,
  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 continuous 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.

bstrap

Boolean for whether or not to perform the multiplier bootstrap inference. Default is `TRUE`. If bstrap is `FALSE`, only the analytical critical value is used.

biters

The number of bootstrap iterations to use. Default is 1000, which is only applicable if bstrap is `TRUE`.

porder

The polynomial order used for the second- and third-stage estimation. Options are 1 and 2, which correspond to the local linear and quadratic regressions, respectively. Default is 2.

kernel

The kernel function used for the local polynomial regressions. Options are "gau" for the Gaussian kernel and "epa" for the Epanechnikov kernel. Default is "gau".

bw

The scalar bandwidth used for the second- and third-stage estimation. Default is `NULL`, and the bandwidth is automatically selected.

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.
ci1_lower: The lower bound of the analytical UCB.
ci1_upper: The upper bound of the analytical UCB.
ci2_lower: The lower bound of the UCB via multiplier bootstrapping.
ci2_upper: The upper bound of the UCB via multiplier bootstrapping.
bw: The bandwidth.

Figure1

A list that contains the ggplot elements for the analytical UCB

Figure2

A list that contains the ggplot elements for the UCB via multiplier bootstrapping

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 = TRUE)
est <- catt_gt_continuous(yname = "Y",
                          tname = "period",
                          idname = "id",
                          gname = "G",
                          zname = "Z",
                          xformla = ~ Z,
                          data = data,
                          zeval = seq(-1, 1, by = 0.1),
                          gteval = c(2, 2),
                          control_group = "nevertreated",
                          anticipation = 0,
                          alp = 0.05,
                          bstrap = TRUE,
                          biters = 1000,
                          porder = 2,
                          kernel = "gau",
                          bw = NULL,
                          uniformall = FALSE,
                          cores = 1)
}