Description Usage Arguments Details Value Examples
bw()
estimates the Rotemberg weights for a Bartik "instrument" outlined in
Goldsmith-Pinkham, Sorkin and Swift (2018) and the just-identified IV
estimates using local industry shares, which are the actual instruments.
1 |
master |
The master data frame. |
y |
A string for outcome variable. It should be a variable in |
x |
A string for the endogenous variable. It should be a variable in
|
controls |
A string or character vector for the control variables.
|
weight |
A string for the weighted variable. |
local |
The local data frame. It should be in wide format. |
Z |
A string or character vector for the the local industry shares. |
global |
The global data frame. |
G |
A string for the the overall industry growth rates. |
The typical Bartik "instrument" has two components: the local industry shares (usually at the level of location-industry or location-year-industry), and the overall industry growth rates (usually at the level of industry or industry-year). The outcome variable and the endogenous variable are at the level of location or location-year.
Because the key variables are at three different levels, bw()
proceeds by
taking three different datasets: (1) a main master
data frame containing
the dependent variable (y
), the causal variable of interest (x
), a set of
control variables (controls
), and the weighted variables (weight
); (2) a
local
data frame containing the set of local industry shares (Z
); and (3)
a global
data frame containing the overall industry growth rates (G
). At
the moment, it is necessary to transform the "local" dataset from long format
to wide format.
A data frame built from global
with two additional variables:
alpha
(the Rotemberg weights), and beta
(the just-identified IV
estimates).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | library(bartik.weight)
index = c("czone", "year")
y = "d_sh_empl_mfg"
x = "d_tradeusch_pw"
controls = c("reg_midatl", "reg_encen", "reg_wncen", "reg_satl",
"reg_escen", "reg_wscen", "reg_mount", "reg_pacif", "l_sh_popedu_c",
"l_sh_popfborn", "l_sh_empl_f", "l_sh_routine33", "l_task_outsource",
"t2", "l_shind_manuf_cbp")
weight = "timepwt48"
Z = setdiff(names(ADH_local_wide), index)
G = "trade_"
bw(ADH_master, y, x, controls, weight, ADH_local_wide, Z, ADH_global, G)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.