# Re: st: Is there a way to use ivreg2 without running the first stage

 From Mark Schaffer To statalist@hsphsun2.harvard.edu, Gregory Dybalski Subject Re: st: Is there a way to use ivreg2 without running the first stage Date Wed, 24 Nov 2004 21:29:49 +0000 (GMT)

```Greg,

Quoting Gregory Dybalski <DybalskiG@gao.gov>:

> Prof. Mark E. Schaffer,
>
> Again, I appreciate your assistance.  I'm sorry if my prior
> submission was unclear.
>
> The fitted values, fittedt1 & fittedt2, are obtained from the
> regression of the endogenous regressor on the included and excluded
> variables.  To obtain these estimates I  use,
> xtreg y1 x1 x2 z1 z2, fe
> The predicted values from this regression are then interacted with the
> year dummy variables to obtain the variables fittedt1 and fittedt2. A
> similar interaction is done for the y1 variables to obtain y1_t1  y1_t2.
>
> These values are used in the instrumental variable estimation.
> ivreg2 y x1 x2 (y1_t1  y1_t2 =  fittedt1  fittedt2)

If I understand correctly, you can think of the two procedures as variations
of how to use your instruments x1, x2, z1, z2, and t.

In the procedure I suggested, you interact 3 variables - t, with z1 and z2 -
to get two more excluded IVs to add to your original 4 IVs (x1, x2, z1 and
z2).  These are multiplicative (i.e., nonlinear) interactions.  The first
stage of 2SLS gets you linear projections of y1_t1 and y1_t2 on these 6
variables (plus a constant).

In your procedure, you regress y1 on x1, x2, z1, and z2, and get yhat (say).
yhat is a linear combination of these 4 IVs (plus a constant).  You then
interact this linear combination with t to get two new variables that are
now nonlinear combinations of the original 5 variables (x1, x2, z1, x2, and
t).  The first stage of 2SLS then gets you linear projections of y1_t1 and
y1_t2 on 4 variables: these 2 nonlinear combinations plus x1 and x2 (and
again a constant).

The parallel that you raised with IV and probit seems to me to be a good
one.  The motivation there was to use a probit to generate nonlinear
combinations of variables that are superior instruments because they are
better predictors - are more "relevant" in the first-stage regression - than
using the variables separately to get linear projections as in standard IV.

I think the same thing is going on here - if your procedure gives you a
first-stage regression (where you assess "relevance") that looks superior to
the procedure that I suggested, then there's no reason why you shouldn't use
it.  Of course, it might instead give you a first-stage regression that
looks worse. :)

Cheers,
Mark

> Sincerely,
>
> Greg Dybalski
>
>
> >Greg,
> >
> >Date sent:       Wed, 24 Nov 2004 10:31:59 -0500
> >From:            "Gregory Dybalski" <DybalskiG@gao.gov>
> >To:              <statalist@hsphsun2.harvard.edu>
> >Subject:         st: Is there a way to use ivreg2 without running
> the
> first stage
> > regression?
> >
> >> Prof. Mark E. Schaffer,
> >>
> should
> >> work.
> >>
> >> I have an similar alternative method that I would like you to
> comment
> >> on.  I referred to the archaic '2SLS' method because I am
> switching
> from
> >> Limdep (ver 8), which, in fact, forces the user to perform IV
> estimation
> >> in two steps.  I originally estimated the model in Limdep because
> it
> >> a procedure to estimate a fixed effects model using IV that
> corrects
> for
> >> autocorrelation.  Your recent changes to the ivreg2 procedure
> now
> >> provide for such estimation.
> >>
> >> Background
> >>
> >> You correctly stated the basic model that I want to estimate
> using
> >> Stata,
> >> ivreg2 y x1 x2 (y1=z1 z2)
> >>
> >> I have 17 years of data for each group and want to examine if
> the
> >> coefficient for the y1 variable is different for earlier years
> than
> the
> >> later years.  To estimate this revised model in Limdep I created
> 4
> >> variables: y1_t1 & y1_t2 (the interaction between y1 and the
> dummy
> >> variable for the time periods) and fittedt1 & fittedt2 (the
> interaction
> >> between the estimated 1st stage values and the dummy variable
> for
> the
> >> time periods).  I used Limdep regression command with 2
> endogenous
> >> regressors and their fitted values.
> >>
> >> To estimate this model in Stata you suggested that I create
> >> variables by interacting the y1 and the excluded instruments with
> a
> >> dummy variable.  Your method interacts the excluded instruments
> with
> the
> >> dummy variable but does not interact the included exogenous
> variables,
> >> x1 & x2, with the dummy.  Your method & mine will not result in
> the
> same
> >> estimated values, but I am not sure that it matters.
> >
> >It's entirely up to you.  If you think that the coefficients on x1
>
> >and x2 may also have changed, then you can also interact these with
>
> >the time dummy, then test etc.  Or if you want to maintain the
> >assumed constancy of these coefficients, then don't interact.
> >
> >> Proposed Alternative Method
> >>
> >> I have an alternative method that I would like you to comment on.
>
> What
> >> happens if I substitute the '1st stage' fitted values for the
> excluded
> >> exogenous variables in the ivreg2 command instead of the z1 and
> z2
> >> variables?  The ivreg2 command would then become,
> >> ivreg2 y x1 x2 (y1_t1  y1_t2 =  fittedt1  fittedt2)
> >
> >I don't understand what fittedt1 and fittedt2 are.  You call them
> the
>
> >first stage fitted values for the the excluded IVs, but excluded
> >exogenous variables never get "fitted" when you do 2SLS - what
> would
> >you regress z1 and z2 on?
> >
> >--Mark
> >
> >> This method should also provide suitable estimates.
> >>
> >> I have reviewed some of the past postings to the Stata list and
> found
> >> this method proposed when the endogenous regression was based on
> a
> >> probit model.   I assume that your proposed method and this
> alternative
> >> would result in suitable estimates.  Is there any reason to
> prefer
> one
> >> method over another.  For example, using your method would
> provide
> >> meaningful output for the test statistics regarding the
> overidenfying
> >> restrictions.
> >>
> >> Greg Dybalski
> >>
> >> >Gregory,
> >> >
> >> >I'm not quite sure I understand what you're asking for.
> >> >
> >> >ivreg2 does standard IV.  Internally, there is only one stage,
> which
> >> >I suppose is standard for packages these days - "2SLS" is a
> somewhat
> >> >archaic term and it isn't common to do IV in two steps any
> more.
> >> >
> >> >In any case, if it's standard IV that you want to do, you should
> be
>
> >> >able to write down a model that can be estimate in one stage;
> if
> you
> >> >can't, then it isn't IV.
> >> >
> >> >In your case, say for example you have two periods.  You have
> one
> >> >endogenous variable and a set of excluded instruments that I
> suppose
> >> >are also time-varying.  You want to know if the coeff on the
> endog
>
> >> >regressor changes over time.  What's wrong with the following?
> >> >
> >> >- say the equation in the original form has 3 regressors, one of
>
> >> >which is endogenous, and 2 excluded instruments:
> >> >
> >> >ivreg2 y x1 x2 (y1=z1 z2)
> >> >
> >> >- Interact your endog regressor y1 with time so that you have
> two
> >> >such regressors, y1_t1 and y1_t2
> >> >
> >> >- Interact your excluded instruments with time to get four
> such
> IVs,
> >> >z1_t1 z1_t2 z2_t1 z2_t2
> >> >
> >> >- Estimate
> >> >
> >> >ivreg2 y x1 x2 (y1_t1 y1_t2 = z1_t1 z1_t2 z2_t1 z2_t2)
> >> >
> >> >and test the equality of the coefficients on y1_t1 and y1_t2.
> >> >
> >> >Probably there's something wrong with this, but a specific
> example
>
> >> >might help to clarify the question.
> >> >
> >> >--Mark
> >> >
> >> >Date sent:       Tue, 23 Nov 2004 11:14:53 -0500
> >> >From:            "Gregory Dybalski" <DybalskiG@gao.gov>
> >> >To:              <statalist@hsphsun2.harvard.edu>
> >> >Subject:         st: Is there a way to use ivreg2 without
> running
> >> the first stage
> >> > regression?
> >> >Send reply to:   statalist@hsphsun2.harvard.edu
> >> >
> >> >> Hi,
> >> >>
> >> >> I am estimating an instrumental variable model having one
> >> endogenous
> >> >> variable on the right hand side (RHS) of the equation.  The
> model
> >> is
> >> >> estimated from panel data, having fixed effects, and
> correcting
> for
> >> >> autocorrelation; heteroscedasicity does not appear to be much
> of
> a
> >> >> problem.
> >> >>
> >> >> Now, I want to re-examine the model where the coefficient
> for
> the
> >> RHS
> >> >> endogenous variable varies over several time periods.  The
> simplest
> >> way
> >> >> to do this would be to take the fitted values from the
> first-stage
> >> and
> >> >> generate the needed instruments.  For example, the values
> for
> the
> >> >> instrument in the initial time period would be equal to the
> >> original
> >> >> fitted values and zero for the other time periods.  The
> remaining
> >> >> instruments would be generated similarly.  What I want to do
> is
> use
> >> >> ivreg2 without running the '1st stage regression'.  So, is
> there
> a
> >> way
> >> >> where I can enter the actual and fitted values for the RHS
> >> endogenous
> >> >> variable into ivreg2?  Or is there another Stata procedure
> that
> >> could
> >> >> estimate the model having these above features.
> >> >>
> >> >> Obviously, I can estimate the model with the fitted values
> using
> a
> >> >> regression procedure, and the model coefficients would be
> properly
> >> >> estimated, but the variances would not be.
> >> >>
> >> >> Greg
> >> >>
> >> >>
> >> >> *
> >> >> *   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 E. Schaffer
> >> >Director
> >> >Centre for Economic Reform and Transformation
> >> >Department of Economics
> >> >School of Management & Languages
> >> >Heriot-Watt University, Edinburgh EH14 4AS  UK
> >> >44-131-451-3494 direct
> >> >44-131-451-3008 fax
> >> >http://www.som.hw.ac.uk/cert
> >> >
> >>
> >> *
> >> *   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 E. Schaffer
> >Director
> >Centre for Economic Reform and Transformation
> >Department of Economics
> >School of Management & Languages
> >Heriot-Watt University, Edinburgh EH14 4AS  UK
> >44-131-451-3494 direct
> >44-131-451-3008 fax
> >http://www.som.hw.ac.uk/cert
> >
>
> *
> *   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-3008
email: m.e.schaffer@hw.ac.uk
web: http://www.sml.hw.ac.uk/ecomes
________________________________________________________________

DISCLAIMER:

This e-mail and any files transmitted with it are confidential
and intended solely for the use of the individual or entity to
whom it is addressed.  If you are not the intended recipient
you are prohibited from using any of the information contained
in this e-mail.  In such a case, please destroy all copies in
Watt University does not accept liability or responsibility
for changes made to this e-mail after it was sent, or for
viruses transmitted through this e-mail.  Opinions, comments,
conclusions and other information in this e-mail that do not
relate to the official business of Heriot Watt University are
not endorsed by it.
________________________________________________________________
*
*   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/
```