pte | R Documentation |
Tools for estimating treatment effects with panel data.
Main function for computing panel treatment effects
pte(
yname,
gname,
tname,
idname,
data,
setup_pte_fun,
subset_fun,
attgt_fun,
cband = TRUE,
alp = 0.05,
boot_type = "multiplier",
weightsname = NULL,
gt_type = "att",
ret_quantile = NULL,
global_fun = FALSE,
time_period_fun = FALSE,
group_fun = FALSE,
process_dtt_gt_fun = process_dtt_gt,
process_dose_gt_fun = process_dose_gt,
biters = 100,
cl = 1,
call = NULL,
...
)
yname |
Name of outcome in |
gname |
Name of group in |
tname |
Name of time period in |
idname |
Name of id in |
data |
balanced panel data |
setup_pte_fun |
This is a function that should take in This function provides also provides a good place for error handling related to the types of data that can be handled. The |
subset_fun |
This is a function that should take in |
attgt_fun |
This is a function that should work in the case where there is a single group and the "right" number of time periods to recover an estimate of the ATT. For example, in the contest of difference in differences, it would need to work for a single group, find the appropriate comparison group (untreated units), find the right time periods (pre- and post-treatment), and then recover an estimate of ATT for that group. It will be called over and over separately by groups and by time periods to compute ATT(g,t)'s. The function needs to work in a very specific way. It should take in the
arguments: If |
cband |
whether or not to report a uniform (instead of pointwise) confidence band (default is TRUE) |
alp |
significance level; default is 0.05 |
boot_type |
should be one of "multiplier" (the default) or "empirical".
The multiplier bootstrap is generally much faster, but |
weightsname |
The name of the column that contains sampling weights. The default is NULL, in which case no sampling weights are used. |
gt_type |
which type of group-time effects are computed.
The default is "att". Different estimation strategies can implement
their own choices for |
ret_quantile |
For functions that compute quantile treatment effects,
this is a specific quantile at which to report results, e.g.,
|
global_fun |
Logical indicating whether or not untreated potential outcomes can be estimated in one shot, i.e., for all groups and time periods. Main use case would be for one-shot imputation estimators. Not supported yet. |
time_period_fun |
Logical indicating whether or not untreated potential outcomes can be estimated for all groups in the same time period. Not supported yet. |
group_fun |
Logical indicating whether or not untreated potential outcomes can be estimated for all time periods for a single group. Not supported yet. These functions aim at reducing or eliminating running the same code multiple times. |
process_dtt_gt_fun |
An optional function to customize results when
the gt-specific function returns the distribution of treated and untreated
potential outcomes. The default is |
process_dose_gt_fun |
An optional function to customize results when the gt-specific
function returns treatment effects that depend on dose (i.e., amount of the
treatment). The default is |
biters |
number of bootstrap iterations; default is 100 |
cl |
number of clusters to be used when bootstrapping; default is 1 |
call |
keeps track of through the |
... |
extra arguments that can be passed to create the correct subsets
of the data (depending on |
pte_results
object
Maintainer: Brantly Callaway brantly.callaway@uga.edu
Useful links:
Report bugs at https://github.com/bcallaway11/ptetools/issues
# example using minimum wage data
# and difference-in-differences identification strategy
library(did)
data(mpdta)
did_res <- pte(
yname = "lemp",
gname = "first.treat",
tname = "year",
idname = "countyreal",
data = mpdta,
setup_pte_fun = setup_pte,
subset_fun = two_by_two_subset,
attgt_fun = did_attgt,
xformla = ~lpop
)
summary(did_res)
ggpte(did_res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.