What I want to find is if Stata stacks the variables, such as is in:

$$ \begin{bmatrix} x_{1t} \\ x_{2t} \end{bmatrix}=\begin{bmatrix} b_{1} \\ a_{1} \end{bmatrix}+\begin{bmatrix} b_2 & b_3 & b_4 \\ a_2 & a_3 & a_4 \end{bmatrix}\begin{bmatrix} z_{1t} \\ z_{2t} \\w_t \end{bmatrix}+\begin{bmatrix} e_t \\ u_t \end{bmatrix} \quad (1)$$

And then uses the predicted values of $x_{t2}$ and $x_{t1}$ in the structural equation normally. Does ivreg2 have any tricky or different stuff that I should be aware of if I am using just the default options for 2sls?

By the way, $x_{t2}$ and $x_{t1}$ are the endogenous variables being instrumented. $z_{t2}$ and $z_{t1}$ are the excluded instruments and $w_t$ is the included instrument in the structural equation.

(If you do answer, could you try cite a source?)


There is no real trick there. When you use ivreg2 for a model of $$y_t = \alpha + \beta_1 x_{1t} + \beta_2 x_{2t} + \beta_3 w_t + \epsilon_t$$

with the corresponding first stages, $$ \begin{align} x_{1t} &= b_1 + b_2 z_{1t} + b_3 z_{2t} + b_4 w_t + e_t \newline x_{2t} &= a_1 + a_2 z_{1t} + a_3 z_{2t} + a_4 w_t + u_t \end{align} $$

the estimation routine runs the first stage regressions first and then uses the fitted values in the second stage. You could easily do this by hand but then the standard errors are not going to be right.

Here is some code to see this:

// use an example data set
webuse nlswork

// run 2sls with two endogenous variables
ivreg2 ln_wage (tenure collgrad = age south), first

// now do this by hand
// generate a dummy to select the same sample as ivreg2
// (keeps the observations without missing values in the variables)
gen sample = e(sample)==1 

// 1st first stage
reg tenure age south if sample==1
predict double tenurehat, xb

// 2nd first stage
reg collgrad age south if sample==1
predict double collgradhat, xb

// second stage regression
reg ln_wage tenurehat collgradhat if sample==1

So this is really all there is to it. Maybe I'm not getting the question but in that case you can tell me in a comment why you would expect ivreg2 to use any "tricks" (what kind of?) and I will update the answer.

  • $\begingroup$ Thank you for your answer, Andy. The thing is that I thought that the first-stage could be run as SUR maybe and I didn't test the results 'by hand' to see this through. Some time ago, when trying to deal with the situation of mixing instruments when you have two or more endogenous variables, I got the following answer: stats.stackexchange.com/questions/163042/…. The answer for the alternative first-stage looked like a SUR to me and the person who answered said that it was the correct first stage, as per Wooldridge (ch. 15). $\endgroup$ – John Doe Sep 4 '15 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.