--- output: pdf_document: citation_package: natbib latex_engine: pdflatex toc: true number_sections: true keep_tex: true includes: in_header: "preamble.tex" title: "Standard Errors in Shift-Share Regressions" author: "Michal Kolesár" date: "`r format(Sys.time(), '%B %d, %Y')`" geometry: margin=1in fontfamily: mathpazo bibliography: library.bib linkcolor: red urlcolor: red fontsize: 11pt vignette: > %\VignetteIndexEntry{ShiftShareSE} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include=FALSE, cache=FALSE} library("knitr") knitr::opts_knit$set(self.contained = FALSE) knitr::opts_chunk$set(tidy = TRUE, collapse=TRUE, comment = "#>", tidy.opts=list(blank=FALSE, width.cutoff=55)) ``` # Summary The package `ShiftShareSE` implements confidence intervals proposed by @akm18 for inference in shift-share least squares and instrumental variables regressions, in which the regressor of interest (or the instrument) has a shift-share structure, as in @bartik91. A shift-share variable has the structure $X_{i}=\sum_{s=1}^{S}w_{is}\Xs_{s}$, where $i$ indexes regions, $s$ indexes sectors, $\Xs_{s}$ are sectoral shifters (or shocks), and $w_{is}$ are shares, such as initial share of region $i$'s employment in sector $s$. This vignette illustrates the use of the package using a dataset from @adh13 (ADH hereafter). The dataset is included in the package as the list `ADH`. The first element of the list, `ADH$reg` is a data-frame with regional variables, the second element, `ADH$sic` is a vector of SIC codes for the sectors, and `ADH$W` is a matrix of shares. See `?ADH` for a description of the dataset. # Examples We now replicate column (1) of Table V in @akm18. First we load the package, define the vector of controls, and define a vector of 3-digit SIC codes: ```{r} library("ShiftShareSE") ctrls <- paste("t2 + l_shind_manuf_cbp + l_sh_popedu_c +", "l_sh_popfborn + l_sh_empl_f + l_sh_routine33", " + l_task_outsource + division") sic <- floor(ADH$sic/10) ``` We cluster the standard errors at the 3-digit SIC code (using the option `sector_cvar`), and, following ADH, weight the data using the weights `ADH$reg$weights`. See `?reg_ss` and `?ivreg_ss` for full description of the options. The first-stage regression: ```{r} reg_ss(as.formula(paste("shock ~ ", ctrls)), W=ADH$W, X=IV, data=ADH$reg, weights=weights, region_cvar=statefip, sector_cvar=sic, method="all") ``` Note that for `"AKM0"`, `"Std. Error"` corresponds to the normalized standard error, i.e. the length of the confidence interval divided by $2z_{1-\alpha/2}$. The reduced-form and IV regressions: ```{r} reg_ss(as.formula(paste("d_sh_empl ~", ctrls)), W=ADH$W, X=IV, data=ADH$reg, region_cvar=statefip, weights=weights, sector_cvar=sic, method="all") ivreg_ss(as.formula(paste("d_sh_empl ~", ctrls, "| shock")), W=ADH$W, X=IV, data=ADH$reg, region_cvar=statefip, weights=weights, sector_cvar=sic, method="all") ``` # Collinear share matrix Let $W$ denote the share matrix with the $(i,s)$ element given by $w_{is}$ and $s$th column $w_s$. Suppose that columns of $W$ are collinear, so that it has rank $S_{0}\chi^{2}_{k, 1-\alpha}$, where $\chi^{2}_{k, 1-\alpha}$ is the $1-\alpha$ quantile of a $\chi^{2}_{k}$. A confidence set is collected by all nulls that are not rejected, \begin{equation*} \text{AKM0 confidence set}= \{\alpha\in\mathbb{R}\colon Q(\alpha)\leq \chi^{2}_{k,1-\alpha} \}, \end{equation*} Note that (i) unlike the case with a single instrument (Remark 6, step (iv)), there is not a closed form solution to the confidence set anymore: one needs to do a grid search over the real line, collecting all values of $\alpha$ for which the test doesn't reject, and (ii) the confidence set will be valid even if the instruments are weak; however, if the instruments are strong, the AKM0 test is less powerful than the AKM test, and consequently the AKM0 confidence set will tend to be bigger than the AKM confidence interval. Not that properties (i) and (ii) are inherited from the properties of the heteroskedasticity-robust version of the Anderson-Rubin test when there is more than one instrument (see, for example, Section 5.1 in @ass19 for a discussion). The AKM0 method adapts this test to the current setting with shift-share instruments, inheriting these properties. If we do not require validity under weak instruments, we can also use a different version of AKM0, namely computing the confidence set as \begin{equation*} \text{Alternative AKM0 confidence set}= \left\{\alpha\in\mathbb{R}\colon \frac{(\hat{\alpha}-\alpha)^{2}}{ \frac{ \sum_{s}(\hat{\beta}'\widehat{\Xs}_{s})^{2}\hat{R}_{s,\alpha}^{2} }{(\hat{\beta}'\ddot{X}'\ddot{X}\hat{\beta})^{2}}} \leq z_{1-\alpha/2}^{2} \right\}. \end{equation*} This form of the confidence can be thought of as the analog to the Lagrange multiplier confidence set in likelihood models, rather than the analog of the Anderson-Rubin test. In the case with a single instrument, these concepts coincide, but they are different in general. In this case, the inequality defining the set is just a quadratic inequality in $\alpha$, and we can solve it explicitly as in Remark 6 in the paper to obtain a closed-form solution. If the instruments are strong, it will take the form of an interval. ## IV with multiple endogenous variables Consider a general setup with eqs. (30) and (31) in the paper replaced by \begin{equation*} Y_{1i}(y_{2})=Y_{1i}(0)+y_{2}'\alpha\qquad Y_{2i}(\xs_{1},\dotsc,\xs_{S})= Y_{2i}(0)+\sum_{s}w_{is}B_{is}'\xs_{s} \end{equation*} with $\Xs$ and $Y_{2}$ now both vectors, and $B_{is}$ has dimensions $\dim(\Xs)\times \dim(Y_{2})$. If $\Xs=Y_{2}$, the setup reduces to that in section \ref{least_squares}. If $Y_{2}$ is scalar, the setup reduces to that in section \ref{instruments}. The two-stage least squares estimator of $\alpha$ is given by \begin{equation*} \hat{\alpha}=(Y_{2}'\ddot{X}(\ddot{X}'\ddot{X})^{-1}\ddot{X}'Y_{2})^{-1}Y_{2}'\ddot{X}(\ddot{X}'\ddot{X})^{-1}\ddot{X}'Y_{1}. \end{equation*} With scalar $X_{i}$ and $Y_{2i}$, this expression reduces to eq. (33) in the paper. Now, \begin{equation*} \hat{\alpha}-\alpha= (Y_{2}'\ddot{X}(\ddot{X}'\ddot{X})^{-1}\ddot{X}'Y_{2})^{-1} Y_{2}'\ddot{X}(\ddot{X}'\ddot{X})^{-1}\cdot \ddot{X}'(Y_{1}-Y_{2}\alpha) \end{equation*} Suppose that \begin{equation*} E[\Xs_{s}\mid \mathcal{F}_{0}]=\Gamma'\Zs_{s}, \end{equation*} where $\mathcal{F}_{0}=(Y_{1}(0),Y_{2}(0),W,\Zs,U,B)$. Let $\delta$ be the coefficient on $Z$ in the regression of $Y_{1i}-Y_{2i}'\alpha$ onto $Z_{i}$, and let $\epsilon_{i}=Y_{1i}-Y_{2i}'\alpha-Z_{i}'\delta=Y_{1i}(0)-Z_{i}'\delta$. Then, as in proof of Proposition 4 in the paper, \begin{equation*} \begin{split} r_{N}^{1/2}\ddot{X}'(Y_{1}-Y_{2}\alpha) & =r_{N}^{1/2}\ddot{X}'(Z\delta+\epsilon) =r_{N}^{1/2}\tilde{\Xs}'W'\epsilon+r_{N}^{1/2}\Gamma' U'\epsilon -r_{N}^{1/2}\epsilon' Z(\hat{\Gamma}-\Gamma),\\ &=r_{N}^{1/2}\tilde{\Xs}'W'\epsilon+o_{p}(1), \end{split} \end{equation*} where the second line follows by arguments in that proof. Now, since $\Xs_{s}$ is independent across $s$ conditional on $\mathcal{F}_{0}$, it follows that conditional on $\mathcal{F}_{0}$, \begin{equation*} r_{N}^{1/2}\tilde{\Xs}'W'\epsilon =r_{N}^{1/2}\sum_{s}\tilde{\Xs}_{s}R_{s} =\mathcal{N}(0,\sum_{s}R^{2}_{s} E[\tilde{\Xs}_{s}\tilde{\Xs}_{s}'\mid \mathcal{F}_{0}])+o_{p}(1), \end{equation*} where $R_{s}=\sum_{i}w_{is}\epsilon_{i}$. This leads to variance formula \begin{equation*} \begin{split} \widehat{\var}(\hat{\alpha})&= (Y_{2}'\ddot{X}(\ddot{X}'\ddot{X})^{-1}\ddot{X}'Y_{2})^{-1}Y_{2}'\ddot{X}(\ddot{X}'\ddot{X})^{-1}\cdot \sum_{s}\hat{R}^{2}_{s} \widehat{\Xs}_{s}\widehat{\Xs}_{s}' \cdot (\ddot{X}'\ddot{X})^{-1}\ddot{X}'Y_{2}(Y_{2}'\ddot{X}(\ddot{X}'\ddot{X})^{-1}\ddot{X}'Y_{2})^{-1}\\ &= (\hat{B}'\ddot{X}'\ddot{X}\hat{B})^{-1}\cdot \sum_{s}\hat{R}^{2}_{s} \hat{B}'\widehat{\Xs}_{s}\widehat{\Xs}_{s}'\hat{B} \cdot (\hat{B}'\ddot{X}'\ddot{X}\hat{B})^{-1}, \end{split} \end{equation*} where $\hat{R}_{s}=\sum_{i}w_{is}\hat{\epsilon}_{i}$, $\widehat{\Xs}=(W' W)^{-1}W'\ddot{X}$ as in eq. (36) in the paper, with rows $\Xs_{s}'$, and $\hat{B}=(\ddot{X}'\ddot{X})^{-1}\ddot{X}'Y_{2}$ is a matrix of the first-stage coefficients. Here $\hat{\epsilon}_{i}$ is an estimate of the structural residual, such as \begin{equation}\label{eq:hat-epsilon} \hat{\epsilon}=(I-Z(Z' Z)^{-1}Z')(Y_{1}-Y_{21}'\hat{\alpha}) \end{equation} For standard errors, take square root of the appropriate diagonal element. The AKM0 version is a little tricky here if $\dim(\alpha)>1$ and we're only interested in inference on one element of $\alpha$, say the first: this is analogous to issues with using the Anderson-Rubin test in a setting with multiple endogenous variables. If we do not require validity under weak instruments, then the analog of the `alternative AKM0' procedure from the preceding subsection uses the estimate $(\alpha_{10}, \hat{\alpha}_{-1}(\alpha_{10}))$ in place of $\hat{\alpha}$ in (\ref{eq:hat-epsilon}), where $\alpha_{10}$ is the null hypothesized value, and \begin{equation*} \hat{\alpha}_{-1}(\alpha_{10})=(Y_{2,-1}'\ddot{X}(\ddot{X}'\ddot{X})^{-1}\ddot{X}'Y_{2,-1})^{-1} Y_{2,-1}'\ddot{X}(\ddot{X}'\ddot{X})^{-1}\ddot{X}'(Y_{1}-Y_{2,1}\alpha_{10}). \end{equation*} is the estimate of the remaining elements of $\alpha$ with the null $H_{0}\colon \alpha_{1}=\alpha_{10}$ imposed. # References