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

Re: st: fixed effect or random effect model

 From Caliph Omar Moumin To "statalist@hsphsun2.harvard.edu" Subject Re: st: fixed effect or random effect model Date Sun, 6 May 2012 04:34:37 -0700 (PDT)

```Thank you John

You told me important info.
i applied it and the result as shown below
is Sargan-Hansen statistic   0.051  Chi-sq(1)    P-value = 0.8219.
So i think this is same result as hausman test. Meaning that we failed to reject null (both fixed and random effect model are ok).
Therefore in My case i want to choose random effect model.
if you think otherwise, could you please let me know?
does Breusch and Pagan Lagrangian multiplier test for random effects makes any change of my choice of random
based on Sargan-Hansen statistic? The result of Breusch and Pagan Lagrangian multiplier test is
chibar2(01) =    59.40;  Prob > chibar2 =   0.0000.

Thank you again John

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

Random-effects GLS regression                   Number of obs      =     16718
Group variable: id                              Number of groups   =     14503

R-sq:  within  = 0.0392                         Obs per group: min =         1
between = 0.0535                                        avg =       1.2
overall = 0.0578                                        max =        16

Wald chi2(4)       =    371.51
corr(u_i, X)   = 0 (assumed)                    Prob > chi2        =    0.0000

(Std. Err. adjusted for 14503 clusters in id)
------------------------------------------------------------------------------
|               Robust
cost |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
duration |   944.5671    152.539     6.19   0.000     645.5962    1243.538
sex |  -4476.141   781.0165    -5.73   0.000    -6006.905   -2945.377
age |     306.88   20.33477    15.09   0.000     267.0246    346.7354
group |   4442.876   1727.691     2.57   0.010     1056.665    7829.087
_cons |   922.7695   3769.766     0.24   0.807    -6465.835    8311.374
-------------+----------------------------------------------------------------
sigma_u |  40329.125
sigma_e |  26038.659
rho |  .70578153   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. xtoverid

Test of overidentifying restrictions: fixed vs random effects
Cross-section time-series model: xtreg re  robust cluster(id)
Sargan-Hansen statistic   0.051  Chi-sq(1)    P-value = 0.8219

xttest0;

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
chibar2(01) =    59.40
Prob > chibar2 =   0.0000

Kind Regards,
Caliph Omar Moumin

Email:  sheikmoumin@yahoo.com

----- Original Message -----
From: John Antonakis <John.Antonakis@unil.ch>
To: statalist@hsphsun2.harvard.edu
Cc:
Sent: Sunday, May 6, 2012 10:31 AM
Subject: Re: st: fixed effect or random effect model

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)

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
statistic."

HTH,
J.

__________________________________________

Prof. John Antonakis
Department of Organizational Behavior
University of Lausanne
Internef #618
CH-1015 Lausanne-Dorigny
Switzerland
Tel ++41 (0)21 692-3438
Fax ++41 (0)21 692-3305
http://www.hec.unil.ch/people/jantonakis

Associate Editor
__________________________________________

On 06.05.2012 02:29, solafem7@yahoo.co.uk 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<sheikmoumin@yahoo.com>
> Sender: owner-statalist@hsphsun2.harvard.edu
> Date: Sat, 5 May 2012 07:46:33
> To: statalist@hsphsun2.harvard.edu<statalist@hsphsun2.harvard.edu>
> 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
>             (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;
> xttest0;
> 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
> xttest3
>
> 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,
> Moumin
>
> Email:  sheikmoumin@yahoo.com
>
> *
> *   For searches and help try:
> *  http://www.stata.com/help.cgi?search
> *  http://www.stata.com/support/statalist/faq
> *  http://www.ats.ucla.edu/stat/stata/
>
> *
> *   For searches and help try:
> *  http://www.stata.com/help.cgi?search
> *  http://www.stata.com/support/statalist/faq
> *  http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*  http://www.stata.com/help.cgi?search
*  http://www.stata.com/support/statalist/faq
*  http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```