Bookmark and Share

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

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

Re: st: fixed effect or random effect model

From   John Antonakis <>
Subject   Re: st: fixed effect or random effect model
Date   Sun, 06 May 2012 10:31:21 +0200

It would be more correct to say that if the p-value for the Hausman test, where you compare random vs fixed-effects, is < .05 then the random-effects estimator is no good (i.e., the test is in the form "hausman fe re"). The fixed-effects estimator is consistent; however, the random-effects estimator is more efficient. If the estimates using random effects are not significantly different from the fixed-effects estimator (i.e., the p-value is > .05) then you can retain the random-effects estimator.

In your case, it would be best to use the user-written -xtoverid- test (available from SSC) after having run

xtreg cost duration sex age group, re cluster(id_indicator)

(id_indicator is your panel identifier)

The xtoverid test accommodates a cluster robust xtreg vce. Specifically, it is a Hausman-type test that constrains the covariance between uj (the fixed-effect) and the regressors to zero. See "help xtoverid": here is the relevant extract from the help file:

"A test of fixed vs. random effects can also be seen as a test of overidentifying restrictions. The fixed effects estimator uses the orthogonality conditions that the regressors are uncorrelated with the idiosyncratic error e_it, i.e., E(X_it*e_it)=0. The random effects estimator uses the additional orthogonality conditions that the regressors are uncorrelated with the group-specific error u_i (the "random effect"), i.e., E(X_it*u_i)=0. These additional orthogonality conditions are overidentifying restrictions. The test is implemented by xtoverid using the artificial regression approach described by Arellano (1993) and Wooldridge (2002, pp. 290-91), in which a random effects equation is reestimated augmented with additional variables consisting of the original regressors transformed into deviations-from-mean form. The test statistic is a Wald test of the significance of these additional regressors. A large-sample chi-squared test statistic is reported with no degrees-of-freedom corrections. Under conditional homoskedasticity, this test statistic is asymptotically equivalent to the usual Hausman fixed-vs-random effects test; with a balanced panel, the artificial regression and Hausman test statistics are numerically equal. See Arellano (1993) for an exact statement and the example below for a demonstration. Unlike the Hausman version, the test reported by xtoverid extends straightforwardly to heteroskedastic- and cluster-robust versions, and is guaranteed always to generate a nonnegative test



Prof. John Antonakis
Faculty of Business and Economics
Department of Organizational Behavior
University of Lausanne
Internef #618
CH-1015 Lausanne-Dorigny
Tel ++41 (0)21 692-3438
Fax ++41 (0)21 692-3305

Associate Editor
The Leadership Quarterly

On 06.05.2012 02:29, wrote:
The Hausman test is actually use to select between fixed and random effect. To know which one to chose you proceed as follow: if the p value is greater than 0.5 then the fixed effect(fe ) is not good chose random effect(re ) and otherwise if reverse is the case. Secondly, to test for autocorrelation after the. 'xtreg' test, you use 'xttest0'
Sent from my BlackBerry wireless device from MTN

-----Original Message-----
From: Caliph Omar Moumin<>
Date: Sat, 5 May 2012 07:46:33
Subject: st: fixed effect or random effect model

Dear all
For the past two weeks i spent to decide whether i apply fixed effect or random effect model in my strongly unbalanced panel data. But I couldn't decide it.
These are the tests i applied so could you please give a minute and advice me what to apply? I understood the my hausman test impllies that i can apply either fixed or random effect modells. Is that so? If that is correct then i choose to apply the random effect model becuase of some time in-variant involved.
What about Breusch-Pagan Lagrange multiplier (LM) test? I have no clue as to how interperate this test? Could any help me? xtdescribe
       id:  6, 9, ..., 809378                                 n =      14503
nadmission1:  1, 2, ..., 16                                  T =         16
            Delta(nadmission1) = 1 unit
            Span(nadmission1)  = 16 periods
            (id*nadmission1 uniquely identifies each observation)
Distribution of T_i:   min      5%     25%       50%       75%     95%     max
                          1       1       1         1         1       2      16
      Freq.  Percent    Cum. |  Pattern
     13302     91.72   91.72 |  1...............
       797      5.50   97.21 |  11..............
       160      1.10   98.32 |  111.............
        97      0.67   98.99 |  1111............
        58      0.40   99.39 |  11111...........
        31      0.21   99.60 |  111111..........
        29      0.20   99.80 |  1111111.........
        12      0.08   99.88 |  11111111........
         8      0.06   99.94 |  111111111.......
         9      0.06  100.00 | (other patterns)
     14503    100.00         |  XXXXXXXXXXXXXXXX
I want to compare between this two groups
xttab group;
                   Overall             Between            Within
     group |    Freq.  Percent      Freq.  Percent        Percent
   alcohol |     275      1.64       191      1.32         100.00
  nonalcoh |   16443     98.36     14312     98.68         100.00
     Total |   16718    100.00     14503    100.00         100.00
                              (n = 14503)

.quietly xtreg cost duration sex age group, fe;
. estimates store fixed;
. quietly xtreg cost duration sex age group, re;
. estimates store random;
hausman fixed random;
                  ---- Coefficients ----
              |      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
              |     fixed        random       Difference          S.E.
     duration |    874.4642     944.5754       -70.11117        84.24204
                            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)
                           =        0.69
                 Prob>chi2 =      0.4053

Breusch-Pagan Lagrange multiplier (LM)test is performed as follows
xtreg cost duration, re;
Breusch and Pagan Lagrangian multiplier test for random effects
         cost[id,t] = Xb + u[id] + e[id,t]
         Estimated results:
                          |       Var     sd = sqrt(Var)
                     cost |   2.27e+09       47647.13
                        e |   6.78e+08       26038.66
                        u |   1.66e+09       40752.23
         Test:   Var(u) = 0
                               chi2(1) =    59.40
                           Prob>  chi2 =     0.0000

A test for heteroskedasticity is performed which shows presence
xtreg  cost duration, fe

Modified Wald test for groupwise heteroskedasticity
in fixed effect regression model
H0: sigma(i)^2 = sigma^2 for all i
chi2 (14503)  = 2.1e+36
Prob>chi2 =      0.0000

Kind Regards,


*   For searches and help try:

*   For searches and help try:
*   For searches and help try:

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