att_gt
computes average treatment effects in DID
setups where there are more than two periods of data and allowing for
treatment to occur at different points in time and allowing for
treatment effect heterogeneity and dynamics.
See Callaway and Sant'Anna (2020) for a detailed description.
att_gt( yname, tname, idname = NULL, gname, xformla = NULL, data, panel = TRUE, allow_unbalanced_panel = FALSE, control_group = c("nevertreated", "notyettreated"), anticipation = 0, weightsname = NULL, alp = 0.05, bstrap = TRUE, cband = TRUE, biters = 1000, clustervars = NULL, est_method = "dr", print_details = FALSE, pl = FALSE, cores = 1 )
yname  The name of the outcome variable 

tname  The name of the column containing the time periods 
idname  The individual (crosssectional unit) id name 
gname  The name of the variable in 
xformla  A formula for the covariates to include in the
model. It should be of the form 
data  The name of the data.frame that contains the data 
panel  Whether or not the data is a panel dataset.
The panel dataset should be provided in long format  that
is, where each row corresponds to a unit observed at a
particular point in time. The default is TRUE. When
is using a panel dataset, the variable 
allow_unbalanced_panel  Whether or not function should
"balance" the panel with respect to time and id. The default
values if 
control_group  Which units to use the control group.
The default is "nevertreated" which sets the control group
to be the group of units that never participate in the
treatment. This group does not change across groups or
time periods. The other option is to set

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 
weightsname  The name of the column containing the sampling weights. If not set, all observations have same weight. 
alp  the significance level, default is 0.05 
bstrap  Boolean for whether or not to compute standard errors using
the multiplier bootstrap. If standard errors are clustered, then one
must set 
cband  Boolean for whether or not to compute a uniform confidence
band that covers all of the grouptime average treatment effects
with fixed probability 
biters  The number of bootstrap iterations to use. The default is 1000,
and this is only applicable if 
clustervars  A vector of variables names to cluster on. At most, there
can be two variables (otherwise will throw an error) and one of these
must be the same as idname which allows for clustering at the individual
level. By default, we cluster at individual level (when 
est_method  the method to compute grouptime average treatment effects. The default is "dr" which uses the doubly robust
approach in the 
print_details  Whether or not to show details/progress of computations.
Default is 
pl  Whether or not to use parallel processing (not implemented yet) 
cores  The number of cores to use for parallel processing (not implemented yet) 
an MP
object containing all the results for grouptime average
treatment effects
Callaway, Brantly and Sant'Anna, Pedro H. C. "DifferenceinDifferences with Multiple Time Periods" Forthcoming at the Journal of Econometrics <https://arxiv.org/abs/1803.09015> (2020).
data(mpdta) # with covariates out1 < att_gt(yname="lemp", tname="year", idname="countyreal", gname="first.treat", xformla=~lpop, data=mpdta) summary(out1)#> #> Call: #> att_gt(yname = "lemp", tname = "year", idname = "countyreal", #> gname = "first.treat", xformla = ~lpop, data = mpdta) #> #> Reference: Callaway, Brantly and Pedro H.C. Sant'Anna. "DifferenceinDifferences with Multiple Time Periods." Forthcoming at the Journal of Econometrics <https://arxiv.org/abs/1803.09015>, 2020. #> #> GroupTime Average Treatment Effects: #> Group Time ATT(g,t) Std. Error [95% Simult. Conf. Band] #> 2004 2004 0.0145 0.0234 0.0761 0.0470 #> 2004 2005 0.0764 0.0296 0.1541 0.0013 #> 2004 2006 0.1404 0.0396 0.2445 0.0364 * #> 2004 2007 0.1069 0.0329 0.1934 0.0204 * #> 2006 2004 0.0005 0.0217 0.0575 0.0565 #> 2006 2005 0.0062 0.0189 0.0557 0.0433 #> 2006 2006 0.0010 0.0192 0.0495 0.0515 #> 2006 2007 0.0413 0.0185 0.0898 0.0072 #> 2007 2004 0.0267 0.0143 0.0108 0.0642 #> 2007 2005 0.0046 0.0159 0.0463 0.0371 #> 2007 2006 0.0284 0.0196 0.0799 0.0230 #> 2007 2007 0.0288 0.0161 0.0710 0.0134 #>  #> Signif. codes: `*' confidence band does not cover 0 #> #> Pvalue for pretest of parallel trends assumption: 0.23267 #> Control Group: Never Treated, Anticipation Periods: 0 #> Estimation Method: Doubly Robust# without covariates out2 < att_gt(yname="lemp", tname="year", idname="countyreal", gname="first.treat", xformla=NULL, data=mpdta) summary(out2)#> #> Call: #> att_gt(yname = "lemp", tname = "year", idname = "countyreal", #> gname = "first.treat", xformla = NULL, data = mpdta) #> #> Reference: Callaway, Brantly and Pedro H.C. Sant'Anna. "DifferenceinDifferences with Multiple Time Periods." Forthcoming at the Journal of Econometrics <https://arxiv.org/abs/1803.09015>, 2020. #> #> GroupTime Average Treatment Effects: #> Group Time ATT(g,t) Std. Error [95% Simult. Conf. Band] #> 2004 2004 0.0105 0.0251 0.0770 0.0560 #> 2004 2005 0.0704 0.0324 0.1562 0.0154 #> 2004 2006 0.1373 0.0401 0.2436 0.0309 * #> 2004 2007 0.1008 0.0366 0.1977 0.0039 * #> 2006 2004 0.0065 0.0254 0.0606 0.0737 #> 2006 2005 0.0028 0.0199 0.0555 0.0499 #> 2006 2006 0.0046 0.0190 0.0551 0.0459 #> 2006 2007 0.0412 0.0219 0.0992 0.0168 #> 2007 2004 0.0305 0.0158 0.0113 0.0724 #> 2007 2005 0.0027 0.0165 0.0465 0.0411 #> 2007 2006 0.0311 0.0179 0.0784 0.0162 #> 2007 2007 0.0261 0.0163 0.0692 0.0171 #>  #> Signif. codes: `*' confidence band does not cover 0 #> #> Pvalue for pretest of parallel trends assumption: 0.16812 #> Control Group: Never Treated, Anticipation Periods: 0 #> Estimation Method: Doubly Robust