*! version 1.00 2apr2020

Title

ivreg_ss -- Computes confidence intervals, standard errors,
and p-values in an IV regression in which the instrumental variable has a
shift-share structure.

Syntax

ivreg_ss depvar,
endogenous_var(varname) shiftshare_iv(varname) share_varlist(varlist) [control_varlist(varlist) weight_var(varname) akmtype(#) beta0(#) path_cluster cluster_var(varname) alpha(#) firststage(#)]

Options

Model
endogenous_var(varname) Endogenous variable in the IV regression.

shiftshare_iv(varname) Shift-share instrumental variable.

share_varlist(varlist) List of variables containing the sector
shares. Each variable indicates the regional shares for the corresponding
sector. Varlist must contain as many variables as there are sectors in the
analysis.

Other options
control_varlist(varlist) List of control variables to be included.

weight_var(varname) Weights to be used in the fitting process.
If specified, weighted least squares is used in the first and second stage;
otherwise, ordinary least squares is used.

akmtype(#) Specifies which inference method to use. It must equal
0 or 1. Under akmtype(1), ivreg_ss applies the AKM inference
procedure described in Adão, Kolesár, and Morales (2019).
Under akmtype(0), ivreg_ss applies the AKM0 inference procedure
described in Adão, Kolesár, and Morales (2019). In this
case, the reported standard error corresponds to the normalized standard error,
given by the length of the corresponding confidence interval divided by
2*invnormal(1-alpha/2). The default is akmtype(1).

beta0(#) Null that is tested when under akmtype(0) (only
affects reported p-values).

path_cluster The path to the .dta file that stores the cluster
information corresponding to each sector. Provide this path if you want to
account for sectoral clusters.

cluster_var(varname) The variable name of the cluster variable
in the .dta file storing the cluster information corresponding to each sector.
The order of the sectors in this .dta file should be the same as the order of
the sectors in the variable list containing the sector shares (share_varlist(varlist)).

alpha(#) Determines confidence level of reported confidence
intervals, which will have coverage 1-#. The default value is
alpha(0.05).

firststage(#) Under firststage(1), the first-stage results
are reported (this requires the command reg_ss to be installed), otherwise
only second-stage results are reported. The default value is
firststage(0).

Note on collinear share matrix

If the share matrix implied by share_varlist(varlist) is
collinear, then it is not possible to to recover the sector-level shares, with
the controls partialled out (tilde_s in the notation of
Adão, Kolesár, and Morales (2019)), and ivreg_ss will
return an error message "Share matrix is collinear". To resolve this problem,
the researcher has three options:

(i) Drop the collinear sectors, and adjust the shift-share instrumental
variable (as specified by shiftshare_iv(varname)) accordinly. For example,
suppose that instead of the original S sectors, we only keep the first S0. Let
w_is denote the shares in location i and sector s, and let X_s denote the shock
to sector s, so that the original definition of the shift-share variable is X_i
= sum_^w_is*X_s. Then after we drop the collinear sectors, the new
shift-share variable will be given by X_i = sum_^w_is*X_s. This
effectively puts shocks to the collinear sectors into the residual (which is
analogous to letting say the shock to non-manufacturing sectors be part of the
residual).

(ii) Aggregate the sectors. For example, instead of using 4-digit
manufacturing codes to define the sectors, use 3-digit codes, defining the shock
to the 3-digit sector as the sum of 4-digit sector shocks. Since the sectoral
shocks and shares are now different, we again need to adjust the definition of
shift-share instrumental variable (as specified by
shiftshare_iv(varname)).

(iii) If the only controls are those with shift-share structure, and we
have data on the sector-level variables Z_s that form these controls, we can
estimate tilde_s directly by regressing the sectoral shocks on Z_s, and
taking the residual, and use this estimate in the standard error formula derived in
Adão, Kolesár, and Morales (2019). This third option is not
currently implemented in this package.

Options (i) and (ii) change the definition of the estimand, if there is
treatment effect heterogeneity. Since they involve changing the shift-share instrumental variable
shiftshare_iv(varname)), the adjustment to this variable needs to be done
before using the ivreg_ss command.

Missing values

Before running regressions using ivreg_ss,
please make sure there are no missing values in any variables that you pass to
the program.

Examples

The data for these examples may be downloaded from the
GitHub repository for this command. The data is a subset of data from Autor, Dorn, and Hanson (2013, ADH). The variables in this dataset are as follows:

d_sh_empl: Change in the share of working-age population.

d_sh_empl_mfg: Change in the share of working-age population employed in manufacturing.

d_sh_empl_nmfg: Change in the share of working-age population employed in non-manufacturing.

d_tradeusch_pw: Change in sectoral U.S. imports from China normalized by U.S. total employment in the corresponding sector, aggregated to regional level. This is the variable of interest in ADH.

d_tradeotch_pw_lag: Change in sectoral imports from China by by a set of high-income countries other than the U.S. normalized by the beginning-of-the period U.S. total employment in the corresponding sector, aggregated to the regional level. This is the instrumental variable in ADH.

emp_share1-emp_share770: The local employment share by region from the first to the 770th sector.

weight: Start-of-period share of U.S. population in each commuting zone (CZ).

state: State identification nunmber (FIPS code).

czone: CZ identification number.

t2: Indicator for the period 2000-2007, which corresponds to the second period in the sample.

l_shind_manuf_cbp: Manufacturing employment share in each CZ (in percentage terms).

l_sh_popedu_c: College-educated population share in each CZ (in percentage terms).

l_sh_popfborn: Foreign-born population share in each CZ (in percentage terms).

l_sh_empl_f: Female employment share in each CZ (in percentage terms).

l_sh_routine33: Share of employment in routine occupations in each CZ (in percentage terms).

l_task_outsource: Offshorability index of occupations in each CZ.

Example 1: AKM standard errors without clustering

. use "data/ADH_derived.dta", clear

. local controls t2 l_shind_manuf_cbp reg_encen reg_escen reg_midatl reg_mount reg_pacif reg_satl reg_wncen reg_wscen l_sh_popedu_c l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource

. ivreg_ss d_sh_empl_mfg, endogenous_var(d_tradeusch_pw) shiftshare_iv(d_tradeotch_pw_lag) control_varlist(`controls') share_varlist(emp_share1-emp_share770) weight_var(weight) alpha(0.05) akmtype(1) firststage(1)

Example 2: AKM0 standard errors without clustering.

. use "data/ADH_derived.dta", clear

. local controls t2 l_shind_manuf_cbp reg_encen reg_escen reg_midatl reg_mount reg_pacif reg_satl reg_wncen reg_wscen l_sh_popedu_c l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource

. ivreg_ss d_sh_empl_mfg, endogenous_var(d_tradeusch_pw) shiftshare_iv(d_tradeotch_pw_lag) control_varlist(`controls') share_varlist(emp_share1-emp_share770) weight_var(weight) akmtype(0)

Example 3: AKM standard errors, clustered at three digit SIC level. Make sure to put "sector_derived.dta" to your local path.

. use "data/ADH_derived.dta", clear

. local controls t2 l_shind_manuf_cbp reg_encen reg_escen reg_midatl reg_mount reg_pacif reg_satl reg_wncen reg_wscen l_sh_popedu_c l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource

. local cpath "data/sector_derived.dta"

. ivreg_ss d_sh_empl, endogenous_var(d_tradeusch_pw) shiftshare_iv(d_tradeotch_pw_lag) control_varlist(`controls') share_varlist(emp_share1-emp_share770) weight_var(weight) akmtype(1) path_cluster(`cpath') cluster_var(sec_3d)

Example 4: AKM0, clustered at three digit SIC level

. use "data/ADH_derived.dta", clear

. local controls t2 l_shind_manuf_cbp reg_encen reg_escen reg_midatl reg_mount reg_pacif reg_satl reg_wncen reg_wscen l_sh_popedu_c l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource

. local cpath "data/sector_derived.dta"

. ivreg_ss d_sh_empl, endogenous_var(d_tradeusch_pw) shiftshare_iv(d_tradeotch_pw_lag) control_varlist(`controls') share_varlist(emp_share1-emp_share770) weight_var(weight) akmtype(0) path_cluster(`cpath') cluster_var(sec_3d)

More examples are available as a do file on the GitHub repository for this command.

Stored results

ivreg_ss stores the following in e():

e(b) Estimate of the coefficient on the endogenous regressor

e(se) Standard error of the estimate of the coefficient on the endogenous regressor

e(CI_low) Lower bound of the confidence interval for the coefficient on the endogenous regressor

e(CI_upp) Upper bound of the confidence interval for the coefficient on the endogenous regressor

e(tstat) T-statistics for the null hypothesis that the coefficient on the endogenous regressor equals zero

e(p) P-value for the null hypothesis that the coefficient on the endogenous regressor equals zero

e(b_firststage) Estimate of the coefficient on the shift-share regressor in the first-stage

e(se_firststage) Standard error of the estimate of the coefficient on the shift-share regressor in the first-stage

e(CI_low_firststage) Lower bound of the confidence interval for the coefficient on the shift-share regressor in the first-stage

e(CI_upp_firststage) Upper bound of the confidence interval for the coefficient on the shift-share regressor in the first-stage

e(tstat_firststage) T-statistics for the null hypothesis that the coefficient on the shift-share regressor equals zero in the first-stage

e(p_firststage) P-value for the null hypothesis that the coefficient on the shift-share regressor equals zero in the first-stage

Bug Reporting

Please, submit bugs, comments, and suggestions by opening an issues at the GitHub repository at https://github.com/zhangxiang0822/BartikSEStata/issues for this command.

Authors

Rodrigo Adão

rodrigo.adao@chicagobooth.edu

Michal Kolesár

mkolesar@princeton.edu

Eduardo Morales

ecmorale@princeton.edu

Xiang Zhang

xiangzhang@princeton.edu

References

Adão, Rodrigo, Michal Kolesár, and Eduardo Morales. "Shift-share designs: Theory and inference." Quarterly Journal of Economics 134, no. 4 (2019): 1949-2010. https://doi.org/10.1093/qje/qjz025

Autor, David, David Dorn, and Gordon H. Hanson. "The China syndrome: Local labor market effects of import competition in the United States." American Economic Review 103, no. 6 (2013): 2121-2168. https://doi.org/10.1257/aer.103.6.2121

You may find a MATLAB version of this command at https://github.com/kolesarm/ShiftShareSEMatlab, and an R version at https://github.com/kolesarm/ShiftShareSE