Bookmark and Share

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


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

st: df_r in xtreg, fe


From   [email protected]
To   [email protected]
Subject   st: df_r in xtreg, fe
Date   Sun, 15 Jan 2012 14:41:27 -0800

Dear listers

I am using Stata/MP 11.1 Windows.

// Refer to the example of fixed-effects model in xtreg help file.

// To keep things simple, a subset with only age and ln_wage that were
observed in 3 years is extracted.

webuse nlswork, clear
keep if year < 71
keep idcode year ln_wage age
reshape wide ln_wage age, i(idcode) j(year)
keep if ln_wage68 ~=. & ln_wage69 ~=. & ln_wage70 ~=.  ///
       & age68 ~=. & age69 ~=. & age70 ~=.
reshape long

// Now we have a balanced and compact data set with 719 persons in 3
years
// Suppose we regress ln_wage on age
xtreg ln_wage age, fe

// The residual sum of squares given by xtreg is
dis `e(df_r)'

// My calculation is
dis 719*(3-1)-2

/* 
In my calculation, 719*3 is the total number of observations, the
subtracted
719 came from the 719 individual time means, the lost 2 degree of
freedom
came from the two estimated parameters. What was I missing here? How
Stata 
calculate the df for RSS in fixed effects models?

I found some related topics in FAQ and help files, but no one seems
directly
answers my question.

Any suggestions/reference is appreciated.
*/

Ning Li
Survey Methodologist
Melbourne Institute of Applied Economic and Social Research
The University of Melbourne
Tel:  +61 3 9035 4949   Fax: +61 3 8344 2111
Email: [email protected]
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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