# Re: st: How to obtain residuals from the first stage for 2 endogenous variables using -ivreg-?

 From "Mark Schaffer" To statalist@hsphsun2.harvard.edu Subject Re: st: How to obtain residuals from the first stage for 2 endogenous variables using -ivreg-? Date Thu, 3 Nov 2005 22:50:23 -0000 (GMT)

```Bo,

> Hi,
>
> I would really appreciate if you would help me on the following problem. I
> have the following equation:
>
> ivreg y (x1 x2 = z1 z2) X
>
> that is, I  use z1 to instrument x1 and z2 to instrument x2.

As Kit Baum has pointed out on Statalist a number of times, this is a
misconception.  x1 and x2 are projected onto both z1 and z2.  You can't
really say, in a single-equation context, that z1 is an instrument for x1
but not x2.

> Now I want to test the endogeneity of x2. I am not worried about x1 at
> this point.

ssc install ivreg2

then you can do an endogeneity test very simply with

ivreg y x2 X (x1 = z1 z2), orthog(x2)

The idea is that x2 is treated as exogenous, but is tested against a
specification that where it is endogenous.

Alternative, you can download and install -ivendog- in the same way, and
after your -ivreg- or -ivreg2- estimation, test the endogeneity of x2 with

ivendog x2

Cheers,
Mark

> One option is to use the argmented regression (Davidson and MacKinnon,
> reference A-J page 541).
> My question is: how to obtain the residuals from the first stage for x1
> and
> x2 after running the above -ivreg- ?
>
> Another option, which I am not so sure is correct, is to do the following:
> ivreg y (x1 x2 = z1 z2) X
> est store myest1
>
> ivreg y (x1 = z1) x2 X
> est store myest2
>
> test whether the coefficient of x1 in estimates myest1 and myest2 differ
> by
> a basically t-stat.
>
> My question: is the above test testing for whether I should model x2 as
> endogenous? should I test for the entire set of coefficients?
>
> Your generous help is very very much appeciated. I am grateful to your
> attention and help!
> Bo MacInnis
> UC Berkeley
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

Prof. Mark Schaffer
Director, CERT
Department of Economics
School of Management & Languages
Heriot-Watt University, Edinburgh EH14 4AS
tel +44-131-451-3494 / fax +44-131-451-3294
email: m.e.schaffer@hw.ac.uk
web: http://www.sml.hw.ac.uk/ecomes

__________________________________________________________________

DISCLAIMER:

This e-mail message is subject to http://www.hw.ac.uk/disclaim.htm
__________________________________________________________________

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```