Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: Re: st: question about (my) ivreg [error!!! with xtivreg2]


From   [email protected]
To   [email protected]
Subject   Re: Re: st: question about (my) ivreg [error!!! with xtivreg2]
Date   Sun, 11 Nov 2007 16:14:40 -0500

Prof. Nichols,
thank you very much for your kind help and the useful link added. 
However, my Stata 9.2. seems unable to run xtivreg2, just as found by 
other colleagues (found in the archive of the statalist).

>xtivreg2  ... ... , fe small
>Error - must have ivreg2 (or ivreg28, for Stata 8 users) version 
2.1.15 or greater installed

I have tried everything, even reinstalling all ivreg2 files (ivreg2 
works at its best) and then again xtivreg2. Nothing, always the same 
message of "Error". I need a new help... Thanks in advance!

Robert

-------------------------------------------------------------------------
------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------

The help files for -ivreg2- and -xtivreg2- have a lot of worked
examples using real data. There is also a discussion at
http://pped.org/stata/ciwod.pdf, page 14, that has a cross-sectional
example:

use http://fmwww.bc.edu/ec-p/data/wooldridge/card, clear
loc x "exper* smsa* south mar black reg662-reg669"
reg lw educ 'x'
ivreg2 lw 'x' (educ=nearc2 nearc4), first endog(educ)
ivreg2 lw 'x' (educ=nearc2 nearc4), gmm
ivreg2 lw 'x' (educ=nearc2 nearc4), liml

but note from the earlier discussion in that paper and the papers
describing -ivreg2- that you do not run two regressions in practice,
and that all the exogenous regressors (x, presuming g is a fixed
effect and w is an error term) in your example are included in the
first stage.  So, making a dataset with names that match yours:

webuse psidextract, clear
ren lw h
ren wks d
ren union x
ren occ z

and comparing the naive two-stage estimator and the correct one-step 
estimator:

xtreg h d x z, fe i(id)
g ok=e(sample)
xtreg d x z if ok, fe i(id)
predict dhat if ok
xtreg h dhat x if ok, fe i(id)
xtivreg h x (d=z), fe i(id)

should produce identical point estimates but very different inferences.

The last line is the "string" you requested, but I prefer

xtivreg2 h x (d=z), fe i(id) cl(id)

for reasons discussed in http://pped.org/stata/ciwod.pdf, and elsewhere.


On Nov 11, 2007 5:40 AM,  <[email protected]> wrote:
> I have a panel (cross-section time-series) of firm data and I need to
> implement the following empirical model, by two-stage least squares.
>
> D_it = x_it z_it f_i u_it
> H_it = D*_it x_it g_i w_it
>
> where:
>
> 1) x_it  - is a set of regressors (hopefully) significant to both
> equations
> 2) z_it  - is a set of regressors that are (hopefully) significant in
> the determination of the first equation but not in the determination 
of
> the second.
> 3) D*_it  - is the set of estimated values of D_it, from the first
> equation.
>
> My problem is that the vector "x_it" is common to both equations! So, 
I
> need to know how to set the model in Stata, with particular reference
> to the implementation of instruments by ivreg (and/or ivreg2). I'm a
> primer, and an example with the string to use would be of help for me.
> Many thanks for your attention.
>
> Regards,
>
> Robert


________________________________________________________________________
Email and AIM finally together. You've gotta check out free AOL Mail! - 
http://mail.aol.com

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index