Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: help


From   "Mark Schaffer" <[email protected]>
To   [email protected]
Subject   Re: st: help
Date   Wed, 30 Jun 2004 16:47:37 +0100

Gang,

From:           	"is300gp" <[email protected]>
To:             	<[email protected]>
Subject:        	st: help
Date sent:      	Mon, 28 Jun 2004 17:38:41 -0700
Send reply to:  	[email protected]

> The following example is from wooldridge Introductory Econometrics
> P463. I'm using Stata to recover the fixed effects and then did it
> mannually, but the two results don't match. Could any body tell me
> why? Thanks a lot. --Gang

I think you'll find that the fixed effects are identical except that 
Stata's are de-meaned so that the average fixed effect is zero.  This 
is part of xtreg's treatment of the contant - if you compare your 
xtreg and regress results, you'll see that xtreg reports a non-zero 
constant, and moreoever, the value of this constant is identical to 
the mean of the fixed effects you calculated by hand.  It's discussed 
in the entry for xtreg in the manual.

--Mark

> 
> clear
> 
> set more 1
> 
> use http://fmwww.bc.edu/ec-p/data/wooldridge/JTRAIN
> 
> keep fcode year lscrap d88 d89 grant grant_1
> 
> drop if lscrap==.
> 
> iis fcode
> 
> tis year
> 
> xtreg lscrap d88 d89 grant grant_1, fe
> 
> ************************************************
> 
> * predict the individual effect
> 
> ************************************************
> 
> predict fix,u
> 
> ************************************************
> 
> * manual calculation, demeanded regression
> 
> ************************************************
> 
> egen mlscrap=mean(lscrap), by(fcode)
> 
> gen dlscrap=lscrap-mlscrap
> 
> egen mgrant=mean(grant), by(fcode)
> 
> gen dgrant=grant-mgrant
> 
> egen mgrant_1=mean(grant_1), by(fcode)
> 
> gen dgrant_1=grant_1-mgrant_1
> 
> egen md88=mean(d88), by(fcode)
> 
> gen dd88=d88-md88
> 
> egen md89=mean(d89), by(fcode)
> 
> gen dd89=d89-md89
> 
> *demeaned regression
> 
> reg dlscrap dd88 dd89 dgrant dgrant_1
> 
> *manually recover the fixed effects, which are the same over time,
> from greene p288
> 
> gen
> fixed=mlscrap-(md88*(-0.0802)+md89*(-.2472)+mgrant*(-.2523)+mgrant_1*(
> -.4216 ))
> 
> order fix fixed
> 
> *
> *   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
44-131-451-3485 CERT administrator
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/



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