What is the formal name of xtreg fe? Is it simply called fixed panel regression?
-
Login or Register
- Log in with
*=========download data, only do this once
webuse set "http://earnhart.org/data"
webuse simple_nlsy, clear
webuse set
save nlsy_simple, replace
*========start from here normally
use nlsy_simple, clear
*===========renaming to get ready for reshaping
foreach var of varlist CV_HGC_9899_1998 CV_HGC_9900_1999 CV_HGC_0001_2000 ///
CV_HGC_0102_2001 CV_HGC_0203_2002 CV_HGC_0304_2003 CV_HGC_0405_2004 ///
CV_HGC_0506_2005 ///
CV_HGC_0607_2006 CV_HGC_0708_2007 CV_HGC_0809_2008 CV_HGC_0910_2009 ///
CV_HGC_1011_2010 CV_HGC_EVER_EDT_2011 {
local year=substr("`var'",-4,.)
rename `var' HGC_`year'
}
*==========drop extraneous stuff and reshape
drop KEYBDATE_M_1997-PARYOUTH_SEX_1997 ASVAB_HIGH_DEGREE_EVER_1999 ASVAB_HIGH_DEGREE_EVER_LAT_1999 ///
CV_HGC_EVER_EDT_2010 VERSION_R15_2011 CV_SAMPLE_TYPE_1997 YHHI_55700A2_2002 YINC_1700A_2001
reshape long YSAQ_360C_ YINC_1700_ HGC_, i(PUBID_1997) j(whatyear)
replace YINC_1700_=. if YINC_1700_<0
replace HGC_=. if HGC_<0
replace YSAQ_360C_=. if YSAQ_360C_<0
*=====making balanced
*====horizontally
egen missobs=rowmiss(YINC_1700_ HGC_ YSAQ_360C_ whatyear)
drop if missobs>0
gen lnyinc=ln(YINC_1700_+1)
*==========deviating from means
egen YINC_mean=mean(lnyinc), by(PUBID_1997)
egen HGC_mean=mean(HGC_), by(PUBID_1997)
egen whatyear_mean=mean(whatyear), by(PUBID_1997)
egen YSAQ_360C_mean=mean(YSAQ_360C_), by(PUBID_1997)
gen YINC_dev=lnyinc-YINC_mean
gen HGC_dev=HGC_-HGC_mean
gen YSAQ_360C_dev=YSAQ_360C_-YSAQ_360C_mean
gen whatyear_dev=whatyear-whatyear_mean
*=========really bad analysis, but gets point across
xtset PUBID_1997
xtreg lnyinc HGC_ YSAQ_360C_ whatyear, fe
reg YINC_dev HGC_dev YSAQ_360C_dev whatyear_dev
Comment