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 solafem7@yahoo.co.uk To statalist@hsphsun2.harvard.edu Subject Re: st: fixed effect or random effect model Date Sun, 6 May 2012 00:29:43 +0000

```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
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/
```