Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: re: AW: re: Method for first stage, in xtivreg

From   Kit Baum <>
Subject   st: re: AW: re: Method for first stage, in xtivreg
Date   Wed, 24 Feb 2010 10:59:27 -0500

Martin offered the challenge

So Kit, can you provide the code to replicate the first stage here?

webuse nlswork, clear
xtivreg ln_w age c.age#c.age not_smsa  /* 
*/ 2.race (tenure = union birth south),  /* 
*/ re first

Yes, I could, but it would take more time than I have to devote to it at this moment. I can demonstrate an example of how it can be done for a balanced panel:

webuse grunfeld,clear
xtivreg invest (mvalue = kstock time), re first
scalar theta = e(theta)

foreach v of varlist mvalue kstock time {
	egen `v'mu = mean(`v'), by(company)
	g double `v'star = `v' - theta*`v'mu
	loc rl "`rl' `v'star"
reg `rl'

The reason why doing the first stage 'by hand' does not work if you merely do 

xtreg mvalue kstock time, re

is that you are not imposing the constraint that the \theta used in the RE-IV model is the one to be used in the first stage. We all know that IV is not really run as two stages, but as a single computation. To pick apart that single computation and get the FSR, you just need to impose the right theta.

That would be a bit of a pain in Martin's example because in the case of unbalanced panels, \theta is not constant over panels, and Stata does not report what the individual \thetas are -- only the median, min, max etc. \thetas. It could be done, of course, but as both -xtivreg- and user-written -xtivreg2- (SSC) will give you the FSRs (and -xtivreg2- will allow you to save those estimates), why would you need to 'roll your own'??

Kit Baum   |   Boston College Economics & DIW Berlin   |
                              An Introduction to Stata Programming  |
   An Introduction to Modern Econometrics Using Stata  |

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index