Este es un resultado interesante, no un mal resultado. Si no hay más regresores que las variables ficticias de tiempo, entonces creo que OLS = RE = FE. (He hecho algunos experimentos con reg y i.year
, xtreg y i.year, fe
y xtreg y i.year, re
pero no lo he probado).
Si $X_{it}$ tienen tendencias y están correlacionados con los efectos fijos, puede pasar cualquier cosa. Por ejemplo, ejecute el siguiente script (copiar y pegar):
set more off
clear all
local n 100
local T 5
set seed 1
set obs `=`n'*`T''
gen id = floor((_n-1)/`T')+1
by id, sort: gen year = _n
xtset id year
tempvar a0
gen `a0' = rnormal() if year==1
by id: egen a = mean(`a0')
gen x = a-year+rnormal()
gen y = a+x-0.2*year+rnormal()
drop a
* So far x and y have been generated.
xtreg y x year, fe
est store fe
xtreg y x year, re
hausman fe ., sigma
set more on
Verá que la FE da una tendencia negativa, la RE da una tendencia positiva, y la prueba de Hausman es muy significativa. (Arriba he incluido una tendencia lineal para simplificar. Los resultados son similares cuando i.year
se utiliza en su lugar). Creo que son las tendencias en X y la presencia de efectos fijos.
. set more off
. clear all
. local n 100
. local T 5
. set seed 1
. set obs `=`n'*`T''
number of observations (_N) was 0, now 500
. gen id = floor((_n-1)/`T')+1
. by id, sort: gen year = _n
. xtset id year
panel variable: id (strongly balanced)
time variable: year, 1 to 5
delta: 1 unit
. tempvar a0
. gen `a0' = rnormal() if year==1
(400 missing values generated)
. by id: egen a = mean(`a0')
. gen x = a-year+rnormal()
. gen y = a+x-0.2*year+rnormal()
. drop a
. * So far x and y have been generated.
. xtreg y x year, fe
Fixed-effects (within) regression Number of obs = 500
Group variable: id Number of groups = 100
R-sq: Obs per group:
within = 0.8276 min = 5
between = 0.9353 avg = 5.0
overall = 0.8066 max = 5
F(2,398) = 955.57
corr(u_i, Xb) = 0.4473 Prob > F = 0.0000
------------------------------------------------------------------------------
y | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
x | .9803594 .0483021 20.30 0.000 .8854004 1.075318
year | -.2207004 .0568937 -3.88 0.000 -.3325502 -.1088506
_cons | .1019471 .1021303 1.00 0.319 -.0988351 .3027294
-------------+----------------------------------------------------------------
sigma_u | 1.1387103
sigma_e | .97339535
rho | .57779363 (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(99, 398) = 3.61 Prob > F = 0.0000
. est store fe
. xtreg y x year, re
Random-effects GLS regression Number of obs = 500
Group variable: id Number of groups = 100
R-sq: Obs per group:
within = 0.8066 min = 5
between = 0.9353 avg = 5.0
overall = 0.8436 max = 5
Wald chi2(2) = 2432.08
corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000
------------------------------------------------------------------------------
y | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
x | 1.40149 .0391177 35.83 0.000 1.32482 1.478159
year | .196468 .0523296 3.75 0.000 .0939039 .299032
_cons | .1267828 .123712 1.02 0.305 -.1156882 .3692539
-------------+----------------------------------------------------------------
sigma_u | .3602397
sigma_e | .97339535
rho | .12046423 (fraction of variance due to u_i)
------------------------------------------------------------------------------
. hausman fe ., sigma
Note: the rank of the differenced variance matrix (1) does not equal the number
of coefficients being tested (2); be sure this is what you expect, or
there may be problems computing the test. Examine the output of your
estimators for anything unexpected and possibly consider scaling your
variables so that the coefficients are on a similar scale.
---- Coefficients ----
| (b) (B) (b-B) sqrt(diag(V_b-V_B))
| fe . Difference S.E.
-------------+----------------------------------------------------------------
x | .9803594 1.40149 -.4211302 .0389278
year | -.2207004 .196468 -.4171684 .0385616
------------------------------------------------------------------------------
b = consistent under Ho and Ha; obtained from xtreg
B = inconsistent under Ha, efficient under Ho; obtained from xtreg
Test: Ho: difference in coefficients not systematic
chi2(1) = (b-B)'[(V_b-V_B)^(-1)](b-B)
= 117.03
Prob>chi2 = 0.0000
. set more on