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

Re: st: Panel FE vs. pooled OLS with demeaned variables


From   May Boggess <[email protected]>
To   [email protected]
Subject   Re: st: Panel FE vs. pooled OLS with demeaned variables
Date   Tue, 20 Sep 2005 10:23:34 -0500

On Tuesday morning, Alice Sun wrote:
I need to run a two-step regression similar to the fixed effect model.
(Xtreg, fe).

I first replicate the fixed effect results by running pooled OLS with
demeaned variables (demean by groups). Yet, I got same coefficients, but
relative larger t statistics.

There is a degrees-of-freedom adjustment to be made. Here is an example that shows how that is done. Here I am primarily interested in the coefficient, and the standard error of that coefficient, of the independent variable "length":

clear
sysuse auto
replace length=length/10
tab head
local df = r(r) - 1
sort head
by head: egen mean = mean(mpg)
by head: gen newmpg = mpg-mean
drop mean
by head: egen mean = mean(len)
by head: gen newlen = len-mean
drop mean

regress newmpg newlen
mat b=e(b)
scalar vadj = e(df_r)/(e(N)-1-(e(df_m) + `df'))
matrix V = vadj*e(V)

cap program drop change
program change, eclass
eret post b V
end
change
eret display
xtreg mpg len, i(head) fe

You should find that the last two sets of results show the same coefficient and standard error for "length".

--May
[email protected]



*
* 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