Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: fixed vs random effect model

 From Clive Nicholas To statalist@hsphsun2.harvard.edu Subject Re: st: fixed vs random effect model Date Mon, 5 Jul 2010 01:32:14 +0100

Martin Weiss replied:

> What`s your rule of thumb then, Steve, for the RE model to be considered? In
> this case, you have -.15, do you still use RE? If you -bootstrap- the thing,
> the CI covers 0 comfortably...
>
>
> ***********
> webuse grunfeld, clear
> xtset company year
> bs e(corr), reps(200) seed(32456): xtreg invest mvalue kstock, i(company) fe
> ***********

For me -- speaking as an idiot non-econometrican -- the key, as I
implied earlier, would be to use both -hausman- and that indicator in
-xtreg, fe- together:

. webuse grunfeld, clear

. xtreg invest mvalue kstock, i(company) fe

Fixed-effects (within) regression               Number of obs      =       200
Group variable (i): company                     Number of groups   =        10

R-sq:  within  = 0.7668                         Obs per group: min =        20
between = 0.8194                                        avg =      20.0
overall = 0.8060                                        max =        20

F(2,188)           =    309.01
corr(u_i, Xb)  = -0.1517                        Prob > F           =    0.0000
^^^^^^^^^
------------------------------------------------------------------------------
invest |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
mvalue |   .1101238   .0118567     9.29   0.000     .0867345    .1335131
kstock |   .3100653   .0173545    17.87   0.000     .2758308    .3442999
_cons |  -58.74393   12.45369    -4.72   0.000    -83.31086     -34.177
-------------+----------------------------------------------------------------
sigma_u |  85.732501
sigma_e |  52.767964
rho |  .72525012   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0:     F(9, 188) =    49.18              Prob > F = 0.0000

. est store fixed

. qui xtreg invest mvalue kstock, re

. est store random

. hausman fixed .

---- Coefficients ----
|      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
|     fixed        random       Difference          S.E.
-------------+----------------------------------------------------------------
mvalue |    .1101238     .1097811        .0003427        .0055213
kstock |    .3100653      .308113        .0019524        .0024516
------------------------------------------------------------------------------
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(2) = (b-B)'[(V_b-V_B)^(-1)](b-B)
=        2.33
Prob>chi2 =      0.3119
^^^^^^^^^

Here, the two statistics reinforce the same conclusion: an RE model
could be fit to this data. But lucky is the researcher who has such
data to play with; certainly not me.

An alternative example (although one could say this is a selective
model, but imagine it was the only data we had):

. webuse nlswork

. xtreg ln_wage age nev_mar south union tenure hours wks_ue wks_work,
i(idcode) fe

Fixed-effects (within) regression               Number of obs      =     13550
Group variable (i): idcode                      Number of groups   =      4001

R-sq:  within  = 0.1325                         Obs per group: min =         1
between = 0.2106                                        avg =       3.4
overall = 0.1744                                        max =        11

F(8,9541)          =    182.14
corr(u_i, Xb)  = 0.1774                         Prob > F           =    0.0000
^^^^^^^^
------------------------------------------------------------------------------
ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
age |   .0046006   .0006602     6.97   0.000     .0033066    .0058947
nev_mar |  -.0295329   .0118592    -2.49   0.013    -.0527794   -.0062863
south |  -.0514096   .0169021    -3.04   0.002    -.0845412    -.018278
union |   .1249207   .0089688    13.93   0.000     .1073399    .1425015
tenure |   .0206019    .001053    19.56   0.000     .0185378    .0226661
hours |  -.0015052   .0003538    -4.25   0.000    -.0021987   -.0008117
wks_ue |  -.0001856   .0004326    -0.43   0.668    -.0010336    .0006624
wks_work |   .0011162   .0001514     7.37   0.000     .0008193     .001413
_cons |   1.500244   .0237174    63.26   0.000     1.453753    1.546735
-------------+----------------------------------------------------------------
sigma_u |  .39638065
sigma_e |  .26223304
rho |  .69556838   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0:     F(4000, 9541) =     5.85          Prob > F = 0.0000

. est store fixed

. qui xtreg ln_wage age nev_mar south union tenure hours wks_ue wks_work, re

. hausman fixed .

---- Coefficients ----
|      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
|     fixed          .          Difference          S.E.
-------------+----------------------------------------------------------------
age |    .0046006     .0029873        .0016134        .0002999
nev_mar |   -.0295329      -.01738       -.0121529        .0066411
south |   -.0514096    -.1348857        .0834761        .0135749
union |    .1249207     .1377239       -.0128032        .0039118
tenure |    .0206019     .0254651       -.0048631        .0004508
hours |   -.0015052    -.0001432        -.001362        .0001495
wks_ue |   -.0001856    -.0008195        .0006339        .0001434
wks_work |    .0011162     .0016362         -.00052        .0000481
------------------------------------------------------------------------------
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(8) = (b-B)'[(V_b-V_B)^(-1)](b-B)
=      440.74
Prob>chi2 =      0.0000
^^^^^^^^^

There's not much more difference in -corr(u_i, Xb)- than that observed
in the Grunfeld data, and yet the Hausman test suggests a
statistically significant difference between the two models fit to
this data, this time favouring FE. No doubt the specialist
needs to be said, which they probably will.

--
Clive Nicholas

[Please DO NOT mail me personally here, but at
<clivenicholas@hotmail.com>. Please respond to contributions I make in