# Question about a derivative of the 2nd-step moments in a two-step estimator as a joint GMM-estimators approach

I'm reading Newey & McFadden - Large sample estimation and hypothesis testing (in the Handbook of Econometrics, Volume 4, 1994, page 2176).

In the model I'm interestend in has some former estimation done before the estimation of the primary model will take place. Hence the primary model (2nd-step) includes some estimated regressors from the former step (the 1st-step).

In order to calculate the asymptotic variance I follow a approach, provided by Newey & McFadden, where the joint GMM-conditions are defined as $\widetilde{g}\left(z,\beta,\alpha\right) = \left[g\left(z,\beta,\alpha\right),m\left(z,\alpha\right)\right]$ where $g\left(z,\beta,\alpha\right)$ are the 2nd-step conditions and $m\left(z,\alpha\right)$ are the 1st-step ones.

The asymptotic variance of the 2nd-step estimator $\widehat{\beta}$ has, under the assumption of uncorrelated 1st- and 2nd-step moments and uncorrelated 1st step moments (if there are more then one 1st-step estimator which will be included in the primary model), the following form:

$Var(\widehat{\beta}) = G_\beta^{-1}\mathbb{E}\left(g(z,\beta,\alpha)g(z,\beta,\alpha)^T\right)(G_\beta^{-1})^T + G_\beta^{-1}G_\alpha\mathbb{E}\left(m(z,\alpha)m(z,\alpha)^T\right)G_\alpha^T (G_\beta^{-1})^T$

where $G_\beta = \frac{\partial\mathbb{E}\left(\widetilde{g}(z,\beta_0, \alpha_0)\right)}{\partial \beta^T}$, $G_\alpha = \frac{\partial\mathbb{E}\left(\widetilde{g}(z,\beta_0, \alpha_0)\right)}{\partial \alpha^T}$

In order to estimate the population moments we replace them by the corresponding sample moments. Assume a OLS-case where the 1st-step looks like

$Z = X\alpha + v$

and the 2nd step like

$y = X\beta_1 + F(v)\beta_2 + e$

with $X$ a $\ n\times k \$-matrix, $\beta_1$ a $\ k\times 1 \$-vector of coefficients and $F(v)$ is the cdf of the 1st-step residuals. $\beta_2$ is the corresponding coefficient for this function. If I set $\widetilde{X} = \left[X ; F(v)\right]$ as the design-matrix of the 2nd-step and $\widetilde{\beta} = \left[\beta_1 ; \beta_2\right]$ as the corresponding vector of coefficients then, for the quantities which determine the asymptotic variance of $\widehat{\beta}$, we will get for a given sample size n

$\widehat{G}_\beta = \frac{\partial\left(\frac{1}{n}\widetilde{X}^T\left( y - \widetilde{X}\widehat{\beta}\right)\right)}{\partial\widehat{\beta}} = - \frac{1}{n}\widetilde{X}^T\widetilde{X}$

The estimator for $\mathbb{E}\left(g(z,\beta,\alpha)g(z,\beta,\alpha)^T\right)$ will be $\frac{1}{n^2}\widetilde{X}^T\left( y - \widetilde{X}\widehat{\beta}\right)\left( y - \widetilde{X}\widehat{\beta}\right)^T\widetilde{X}$

Analogously for $\mathbb{E}\left(m(z,\alpha)m(z,\alpha)^T\right)$ we get $\frac{1}{n^2}X^T\left( y - X\widehat{\alpha}\right)\left( y - X\widehat{\alpha}\right)^TX$

Question: I'm not sure how to derive the estimator for $G_\alpha$. Since $\widehat{G}_\alpha = \frac{\partial\left(\frac{1}{n}\widetilde{X}^T\left( y - \widetilde{X}\widehat{\beta}\right)\right)}{\partial\widehat{\alpha}}$ and $F(v)$ is a column of $\widetilde{X}$ this should be equal to

$\widehat{G}_\alpha = \frac{\partial\left( F(v)\widehat{\beta_1}\right)}{\partial\widehat{\alpha}}$

Since $F(v)$ is the cdf of $v$ this should be somthing like a function of the pdf of $v$ but im not quite sure how start. Because $\widehat{\beta} = \left(\widetilde{X}^T\widetilde{X}\right)^{-1}\widetilde{X}^Ty$ the entry $\widehat{\beta}_1$ should depend upon $\widehat{\alpha}$ too but im not quite sure about this. A hint would be very helpful.

• $X$ is a matrix, $F$ is a function, how exactly do you put them together into matrix $\tilde{X}$? – mpiktas Dec 28 '12 at 8:32
• Hi, columnwise. $F$ the cumulative distribution function will be appield to $v$ the $\ n\times 1 \$-vector of residuals of the 1st-step esimation. So $\widetilde{X}$ will then be a $\ n\times (k+1) \$-matrix. – Druss2k Dec 28 '12 at 16:49
• Yes. How do you "apply" cdf to vector of residuals? Say I have a vector $(1,2,3)$ what would be a $F(v)$ version of it? – mpiktas Dec 29 '12 at 22:09
• It is a first time I see empirical cdf added to regression in such a way. What is the point of that? I suspect the answer lies in the idea of adding such type of the regressor. In general there is a problem of finding derivatives of empirical cdfs, since it would involve finding derivatives of minimum and maximum, which are not differentiable in general case. – mpiktas Jan 1 '13 at 17:16
• Paper would be nice. Mail me at mySEusername@gmail.com. – mpiktas Jan 1 '13 at 18:02

I have a hypothesis of how to approach this problem. The key here is to know that second step can be written like this:

$$y_i=X_i\beta_1+c_i\beta_2+e_i,$$

where

$$c_i=F(v_i)$$

where $F$ is the theoretical cdf of $v$. Then assuming $F$ has a density, you can differentiate it. So

$$\frac{\partial F(v_i)}{\partial \alpha}=f(v_i)\frac{\partial (v_i|_{v_i=Z_i-X_i\alpha})}{\partial \alpha},$$

which is not hard to calculate given that $f=F'$ exists.

What threw me off, is that when estimating $F$ is exchanged with consistent estimator $\hat{F}$, which is clearly not differentiable (in general case) with respect to $\alpha$.

• Yes I agree. With a "Plug-In" approach do we get something like $-\hat{f}(\hat{v})A$ as a estimator for the derivative $\frac{\partial F(v_i)}{\partial \alpha}$? A is a submatrix of X which only contains the exogenous regressors of X since the first step residuals $v_i$ is the reduced form regression of the endogenous regressor. – Druss2k Jan 1 '13 at 18:46
• yes only the parenthesis is missing :) – mpiktas Jan 1 '13 at 18:48
• I just edited the parenthesis into the equation =). Since $G_\beta$ is a $\ n \times n \$-matrix the dimesion of $-\hat{f}(\hat{v})A$ does not fit if $\hat{f}(\hat{v})$ is a $\ n \times \ 1 \$-vector and $A$ a $\ n \times k_1 \$-matrix where $k_1$ is the number of exogenous regressors within $X$. – Druss2k Jan 1 '13 at 18:56
• If you use R syntax for multiplying vector with matrix, then yes the dimensions are ok. Mathematically, $f(v)$ is the column vector and $A$ is the matrix, so you cannot multiply them in the usual matrix multiplication sense. – mpiktas Jan 1 '13 at 18:57
• Mathematically it would be $diag(f(v))A$, where $diag$ is the diagonal operator, taking vector and producing the matrix which has vector on the main diagonal and zeroes everywhere else. – mpiktas Jan 1 '13 at 18:59