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

st: help


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

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

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/



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