Uniform Inference for Group-Time Conditional Average Treatment Effects Given a Continuous Covariate
catt_gt_continuous.Rd`catt_gt_continuous` computes doubly robust estimates and uniform confidence bands for the group-time conditional average treatment effect (CATT) function given a continuous pre-treatment covariate in the staggered difference-in-differences setup of Callaway and Sant'Anna (2021) for balanced panel data. See Imai, Qin, and Yanagi (2025) for more details.
Usage
catt_gt_continuous(
  yname,
  tname,
  idname,
  gname,
  zname,
  xformla,
  data,
  zeval,
  gteval = NULL,
  pretrend = FALSE,
  control_group = "notyettreated",
  anticipation = 0,
  alp = 0.05,
  bstrap = TRUE,
  biters = 1000,
  porder = 2,
  kernel = "gau",
  bwselect = "IMSE1",
  bw = NULL,
  uniformall = TRUE
)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 constructed automatically. 
- pretrend
- Boolean for whether or not to perform the uniform inference for CATT in the pre-treatment periods (i.e., conditional pre-trends). This parameter is only applicable if `gteval = NULL`. Default is `FALSE`. 
- control_group
- Which units to use the control group. Options are "nevertreated" and "notyettreated". Default is "notyettreated". 
- 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 weighted bootstrapping. Default is `TRUE`. If bstrap is `FALSE`, only the analytical critical value is used. 
- biters
- The number of bootstrap iterations. This parameter is only applicable if bstrap is `TRUE`. Default is 1000. 
- 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". 
- bwselect
- The bandwidth selection method used for the second- and third-stage estimation. Options are "IMSE1", "IMSE2", "US1", and "manual". "IMSE1" and "IMSE2" mean the IMSE-optimal bandwidths for the local linear and quadratic regressions, respectively. "US1" means the rule-of-thumb undersmoothing bandwidth for the local linear regression. "manual" means the manual selection and bw should be specified in this case. Default is "IMSE1", which is recommended for use with `porder = 2`. 
- bw
- The bandwidth used for the second- and third-stage estimation. Default is `NULL` and the bandwidth is chosen automatically. This parameter is only applicable if bwselect is "manual", and should be a scalar or a vector whose length equals to the number of rows of gteval. 
- uniformall
- Boolean for whether or not to perform the uniform inference over (g, t, z). Default is `TRUE`, and the uniform inference over (g, t, z) is performed. If `FALSE`, the uniform inference only over z is performed. 
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 bootstrap UCB.
 ci2_upper: The upper bound of the bootstrap UCB.
 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 bootstrap 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. (2025). Doubly robust uniform confidence bands for group-time conditional average treatment effects in difference-in-differences. arXiv preprint arXiv:2305.02185.
Examples
if (FALSE) { # \dontrun{
data <- datageneration(
  n = 500,
  tau = 4
)
output <- 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),
  pretrend = FALSE,
  control_group = "notyettreated",
  anticipation = 0,
  alp = 0.05,
  bstrap = TRUE,
  biters = 1000,
  porder = 2,
  kernel = "gau",
  bwselect = "IMSE1",
  bw = NULL,
  uniformall = TRUE
)
} # }