ddid2.Rd
ddid2
computes the Quantile Treatment Effect
on the Treated (QTET) using the method of Callaway, Li, and Oka (2015).
ddid2(
formla,
xformla = NULL,
t,
tmin1,
tname,
data,
panel = TRUE,
dropalwaystreated = TRUE,
idname = NULL,
probs = seq(0.05, 0.95, 0.05),
iters = 100,
alp = 0.05,
method = "logit",
se = TRUE,
retEachIter = FALSE,
seedvec = NULL,
pl = FALSE,
cores = NULL
)
The formula y ~ d where y is the outcome and d is the treatment indicator (d should be binary)
A optional one sided formula for additional covariates that will be adjusted for. E.g ~ age + education. Additional covariates can also be passed by name using the x paramater.
The 3rd time period in the sample (this is the name of the column)
The 2nd time period in the sample (this is the name of the column)
The name of the column containing the time periods
The name of the data.frame that contains the data
Boolean indicating whether the data is panel or repeated cross sections
How to handle always treated observations in panel data case (not currently used)
The individual (cross-sectional unit) id name
A vector of values between 0 and 1 to compute the QTET at
The number of iterations to compute bootstrap standard errors. This is only used if se=TRUE
The significance level used for constructing bootstrap confidence intervals
The method for estimating the propensity score when covariates are included
Boolean whether or not to compute standard errors
Boolean whether or not to return list of results from each iteration of the bootstrap procedure
Optional value to set random seed; can possibly be used in conjunction with bootstrapping standard errors.
boolean for whether or not to compute bootstrap error in parallel. Note that computing standard errors in parallel is a new feature and may not work at all on Windows.
the number of cores to use if bootstrap standard errors are computed in parallel
QTE
object
Callaway, Brantly, Tong Li, and Tatsushi Oka. ``Quantile Treatment Effects in Difference in Differences Models under Dependence Restrictions and with Only Two Time Periods.'' Working Paper, 2015.
##load the data
data(lalonde)
## Run the ddid2 method on the observational data with no covariates
d1 <- ddid2(re ~ treat, t=1978, tmin1=1975, tname="year",
data=lalonde.psid.panel, idname="id", se=FALSE,
probs=seq(0.05, 0.95, 0.05))
#> Warning: dropping 2675 observations that are not in period: 1978, 1975, ...
#> Warning: covariates appear to vary over time...
#> only conditioning on first period covariates...
#> this is recommended practice, but worth noting...
summary(d1)
#>
#> Quantile Treatment Effect:
#>
#> tau QTE
#> 0.05 10616.61
#> 0.1 5019.83
#> 0.15 2388.12
#> 0.2 1033.23
#> 0.25 485.23
#> 0.3 943.05
#> 0.35 931.45
#> 0.4 945.35
#> 0.45 1205.88
#> 0.5 1362.11
#> 0.55 1279.05
#> 0.6 1618.13
#> 0.65 1834.30
#> 0.7 1326.06
#> 0.75 1586.35
#> 0.8 1256.09
#> 0.85 723.10
#> 0.9 251.36
#> 0.95 -1509.92
#>
#> Average Treatment Effect: 2326.51
## Run the ddid2 method on the observational data with covariates
d2 <- ddid2(re ~ treat, t=1978, tmin1=1975, tname="year",
data=lalonde.psid.panel, idname="id", se=FALSE,
xformla=~age + I(age^2) + education + black + hispanic + married + nodegree,
probs=seq(0.05, 0.95, 0.05))
#> Warning: dropping 2675 observations that are not in period: 1978, 1975, ...
#> Warning: covariates appear to vary over time...
#> only conditioning on first period covariates...
#> this is recommended practice, but worth noting...
#> Warning: Solution may be nonunique
#> Warning: Solution may be nonunique
#> Warning: Solution may be nonunique
#> Warning: Solution may be nonunique
summary(d2)
#>
#> Quantile Treatment Effect:
#>
#> tau QTE
#> 0.05 9832.19
#> 0.1 4544.63
#> 0.15 2068.77
#> 0.2 849.12
#> 0.25 485.23
#> 0.3 943.05
#> 0.35 817.00
#> 0.4 681.37
#> 0.45 1010.12
#> 0.5 992.30
#> 0.55 938.13
#> 0.6 950.31
#> 0.65 977.04
#> 0.7 366.22
#> 0.75 563.49
#> 0.8 -352.59
#> 0.85 -825.48
#> 0.9 -1978.06
#> 0.95 -3333.16
#>
#> Average Treatment Effect: 1665.63