# How to choose between FE and BE model

Baum, C. F. (2006). An Introduction to Modern Econometrics Using Stata (Stata Press, ed.).

In particular Chapter 9 treats panel data and explains the Fixed Effect (FE) models and the Between Estimator (BE) model.

At a certain point there is written:

With panel data, we can identify whether the interesting sources of variation are in individuals’ variation around their means or in those means themselves. The within estimator takes account of only the former, whereas the between estimator considers only the latter.

But it doesn't explain how to do that. How do I choose from a FE model rather than a BE model?

I know there is the Hausman test to choose between FE and Random Effects (RE). Is there such a test to choose between FE and BE too?

It is very unlikely that you would ever want to choose between these two extremes. You would likely only go with a BE model if 90%+ of the variance (as indexed by the intraclass correlation coefficient) is between units (just pulling a number out of thin air here).

Alternatively, you can use a RE model to get both the within and between coefficients in the same model.

For each predictor that varies within clusters, calculate the mean of that variable for each cluster:

bysort cluster: egen cmn_x = mean(x)

Then run the RE model:

xtreg y x cmn_x, i(cluster) re

The coefficient for cmn_x is the difference in size of the coefficient of the between effect relative to the within effect. The test of significance for cmn_x tells you whether the between effect is different from the within effect. You can easily recover the pure between effect:

lincom x + cmn_x

As an exmaple, we can use the admissions.dta from the Stata 15 manual, which has data on admissions from a set of departments within a university:

use http://www.stata-press.com/data/r15/admissions.dta, clear
describe

vars:             5                          25 Feb 2016 09:28
size:           644                          (_dta has notes)
------------------------------------------------------------------------------------------
storage   display    value
variable name   type    format     label      variable label
--------------------------------------------------------------------------------------
department      long    %8.0g      dept       department id
napplied        float   %9.0g                 number of applications
female          byte    %8.0g                 =1 if female, =0 if male


The between effect model predicting # of admissions from # applied:

xtreg nadmitted napplied, i(department) be

Between regression (regression on group means)  Number of obs     =         46
Group variable: department                      Number of groups  =         23

R-sq:                                           Obs per group:
within  = 0.7392                                         min =          2
between = 0.4398                                         avg =        2.0
overall = 0.5302                                         max =          2

F(1,21)           =      16.49
sd(u_i + avg(e_i.))=  7.859423                  Prob > F          =     0.0006

------------------------------------------------------------------------------
nadmitted |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
napplied |    .180098   .0443518     4.06   0.001     .0878634    .2723326
_cons |   7.719926   2.586917     2.98   0.007     2.340136    13.09971
------------------------------------------------------------------------------


Now the within effect:

xtreg nadmitted napplied, i(department) fe

Fixed-effects (within) regression               Number of obs     =         46
Group variable: department                      Number of groups  =         23

R-sq:                                           Obs per group:
within  = 0.7392                                         min =          2
between = 0.4398                                         avg =        2.0
overall = 0.5302                                         max =          2

F(1,22)           =      62.37
corr(u_i, Xb)  = -0.2430                        Prob > F          =     0.0000

------------------------------------------------------------------------------
nadmitted |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
napplied |   .2428959   .0307572     7.90   0.000     .1791093    .3066825
_cons |    4.88583   1.594119     3.06   0.006     1.579828    8.191831
-------------+----------------------------------------------------------------
sigma_u |  8.0368968
sigma_e |  5.3163754
rho |  .69561491   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(22, 22) = 4.30                      Prob > F = 0.0006


Now put them together in the RE model (switching to mixed for REML b/c of small sample size), first calculating the cluster mean of napplied:

bysort department: egen cmn_app=mean(napplied)

mixed nadmitted napplied cmn_app || department:, reml

Mixed-effects REML regression                   Number of obs     =         46
Group variable: department                      Number of groups  =         23

Obs per group:
min =          2
avg =        2.0
max =          2

Wald chi2(2)      =      78.85
Log restricted-likelihood = -160.93643          Prob > chi2       =     0.0000

------------------------------------------------------------------------------
nadmitted |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
napplied |   .2428959   .0307572     7.90   0.000     .1826128    .3031789
cmn_app |  -.0627979    .053973    -1.16   0.245    -.1685831    .0429873
_cons |   7.719926   2.586918     2.98   0.003      2.64966    12.79019
------------------------------------------------------------------------------

------------------------------------------------------------------------------
Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
department: Identity         |
var(_cons) |   47.63861    19.5332       21.3276    106.4085
-----------------------------+------------------------------------------------
var(Residual) |   28.26384   8.521869      15.65252    51.03618
------------------------------------------------------------------------------
LR test vs. linear model: chibar2(01) = 10.87         Prob >= chibar2 = 0.0005


Recover the pure between effect:

lincom napplied+cmn_app