# Re: st: Panel Data-FIXED, RANDOM EFFECTS and Hausman Test

 From Muhammad Billal Malik To statalist@hsphsun2.harvard.edu Subject Re: st: Panel Data-FIXED, RANDOM EFFECTS and Hausman Test Date Mon, 2 Mar 2009 21:00:00 +0000

```1st Questtion if I have carrried out a Breusch-pagan LM test and my
model has obtained a value greater than 0.06 therefore I accept the
random effects model, right?

2nd Question: My results for the coefficiants of the random effects
model and fixed effects model are very different, with very different
coefficiants and p values. Is this a problem? But the test has passed
the Breusch Pagan Test for RE model, if I am right about Question 1.

Random-effects GLS regression                   Number of obs      =        43
Group variable (i): region                      Number of groups   =         7

R-sq:  within  = 0.4110                         Obs per group: min =         2
between = 0.9912                                        avg =       6.1
overall = 0.9550                                        max =         8

Random effects u_i ~ Gaussian                   Wald chi2(6)       =    763.37
corr(u_i, X)       = 0 (assumed)                Prob > chi2        =    0.0000

------------------------------------------------------------------------------
lny |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
lx1 |   .1301386   .0466017     2.79   0.005      .038801    .2214762
lx2 |   .1708776   .0772652     2.21   0.027     .0194406    .3223145
lx3 |    3.27485   .6616212     4.95   0.000     1.978097    4.571604
lx4 |   .6025669   .1123974     5.36   0.000     .3822721    .8228617
lx5 |   4.753912   1.088747     4.37   0.000     2.620007    6.887817
lx6 |   .9487478   .2355224     4.03   0.000     .4871324    1.410363
_cons |  -36.19591   5.482063    -6.60   0.000    -46.94055   -25.45126
-------------+----------------------------------------------------------------
sigma_u |          0
sigma_e |  .03410935
rho |          0   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. xtreg lny lx1 lx2 lx3 lx4 lx5 lx6, fe

Fixed-effects (within) regression               Number of obs      =        43
Group variable (i): region                      Number of groups   =         7

R-sq:  within  = 0.8302                         Obs per group: min =         2
between = 0.7280                                        avg =       6.1
overall = 0.6779                                        max =         8

F(6,30)            =     24.45
corr(u_i, Xb)  = 0.6968                         Prob > F           =    0.0000

------------------------------------------------------------------------------
lny |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
lx1 |  -.0021639   .0069926    -0.31   0.759    -.0164448    .0121169
lx2 |   .1352655   .0220522     6.13   0.000      .090229    .1803021
lx3 |   .2685463   .1091373     2.46   0.020     .0456582    .4914345
lx4 |   .1267882   .0500629     2.53   0.017     .0245461    .2290303
lx5 |   .8111474   .1926396     4.21   0.000      .417725     1.20457
lx6 |  -.0138814   .0480629    -0.29   0.775     -.112039    .0842761
_cons |   -.683041   1.127701    -0.61   0.549    -2.986114    1.620032
-------------+----------------------------------------------------------------
sigma_u |  1.0104691
sigma_e |  .03410935
rho |  .99886183   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0:     F(6, 30) =   369.90               Prob > F = 0.0000

On Fri, Feb 27, 2009 at 7:42 PM, David Greenberg <dg4@nyu.edu> wrote:
> No, it is not difficult to understand and estimate these models. Look at these papers:
>   Nathaniel Beck and Jonathan N. Katz, ?What To Do (and Not To Do)With Time-Series Cross-Section Data,? American Political Science Review 89.3 (Sept. 1995): 634-47.
> _____, ?Time-Series-Cross-Section Data: What Have We Learned in the Past Few Year,? Annual Review of Political Science 4 (2001):271-93.
>  The models can be estimated in Stata using the xtpcse keyword.    - David Greenberg, Sociology Department, New York University
>
> ----- Original Message -----
> Date: Friday, February 27, 2009 7:54 am
> Subject: Re: st: Panel Data-FIXED, RANDOM EFFECTS and Hausman Test
> To: statalist@hsphsun2.harvard.edu
>
>
>> I am sorry David, but I have not been taught that in my Basic
>> Econometric course, will it be easy to understand and run?
>>
>> On Thu, Feb 26, 2009 at 9:26 PM, David Greenberg <dg4@nyu.edu> wrote:
>> > With a small number of nations and more years than nations you may
>> be better off using panel-corrected standard errors than the approach
>> you are taking. David Greenberg, Sociology Department, New York University
>> >
>> > ----- Original Message -----
>> > Date: Thursday, February 26, 2009 2:20 pm
>> > Subject: st: Panel Data-FIXED, RANDOM EFFECTS and Hausman Test
>> > To: statalist@hsphsun2.harvard.edu
>> >
>> >
>> >> I am having some problems with my econometrics based dissertation.
>> I
>> >> doing a panel data on 12 sub-saharan african nations, with 6 variables
>> >> over a 17 year time period.
>> >>
>> >> I am using a simple log log model to test to see if one of my
>> >> variables lx2 (tourism receipts) has a positive affect on GDP. I have
>> >> run a pooled regression, then fixed effects between and within, and
>> >> finally a random effects. I have then carried out a Hausman test and
>> >> achieved a negative value, which has confused me more. I was wondering
>> >> what do I do, as in what model shall I choose? I have attached my
>> >> STATA output so you can see if I have gone through the right steps.
>> >>
>> >> I will really appreciate if you can help me,
>> >>
>> >> Kind Regards,
>> >>
>> >> Mohammud
>> >>
>> >>
>> >> Carrying out a pooled data regression
>> >> . regress ly lx1 lx2 lx3 lx4 lx5 lx6
>> >>
>> >>       Source |       SS       df       MS              Number of
>> obs =
>> >>      57
>> >> -------------+------------------------------           F(  6,
>>  50) =
>> >>   52.04
>> >>        Model |  59.1406489     6  9.85677481           Prob > F
>>  =
>> >>  0.0000
>> >>     Residual |  9.47031674    50  .189406335           R-squared
>>   =
>> >>  0.8620
>> R-squared =
>> >>  0.8454
>> >>        Total |  68.6109656    56  1.22519581           Root MSE
>>  =
>> >>  .43521
>> >>
>> >> ------------------------------------------------------------------------------
>> >>           ly |      Coef.   Std. Err.      t    P>|t|     [95%
>> Conf. Interval]
>> >> -------------+----------------------------------------------------------------
>> >>          lx1 |    .173204   .0545574     3.17   0.003     .0636223
>> >> .2827857
>> >>          lx2 |   .0816157   .0737985     1.11   0.274    -.0666129
>> >> .2298442
>> >>          lx3 |   1.207415   .7336368     1.65   0.106    -.2661382
>> >> 2.680968
>> >>          lx4 |   .8167941   .0985049     8.29   0.000     .6189412
>> >> 1.014647
>> >>          lx5 |   4.014936   1.263028     3.18   0.003     1.478069
>> >> 6.551803
>> >>          lx6 |   .2619006   .2371792     1.10   0.275    -.2144879
>> >> .738289
>> >>        _cons |   -20.5465   5.498655    -3.74   0.000    -31.59087
>>   -9.502123
>> >> ------------------------------------------------------------------------------
>> >>
>> >> . gen country = region
>> >> Setting up a panel
>> >> . tsset country year, yearly
>> >>        panel variable:  country (strongly balanced)
>> >>         time variable:  year, 1990 to 2006
>> >>
>> >> Carrying out a fixed effects within regression on panel data
>> >> . xtreg ly lx1 lx2 lx3 lx4 lx5 lx6, fe
>> >>
>> >> Fixed-effects (within) regression               Number of obs      =
>> >>      57
>> >> Group variable (i): country                     Number of groups
>> =
>> >>      10
>> >>
>> >> R-sq:  within  = 0.7640                         Obs per group: min
>> =
>> >>       2
>> >>        between = 0.5507                                        avg
>> =
>> >>     5.7
>> >>        overall = 0.5374                                        max
>> =
>> >>       8
>> >>
>> >>                                                 F(6,41)            =
>> >>   22.12
>> >> corr(u_i, Xb)  = 0.5835                         Prob > F
>> =
>> >>  0.0000
>> >>
>> >> ------------------------------------------------------------------------------
>> >>           ly |      Coef.   Std. Err.      t    P>|t|     [95%
>> Conf. Interval]
>> >> -------------+----------------------------------------------------------------
>> >>          lx1 |  -.0075411   .0061342    -1.23   0.226    -.0199293
>> >> .0048472
>> >>          lx2 |   .1397473   .0208394     6.71   0.000     .0976612
>> >> .1818334
>> >>          lx3 |  -.0471179   .0766965    -0.61   0.542    -.2020095
>> >> .1077738
>> >>          lx4 |   .0883038   .0510516     1.73   0.091    -.0147971
>> >> .1914046
>> >>          lx5 |   .4423916   .1609951     2.75   0.009     .1172554
>> >> .7675278
>> >>          lx6 |  -.0635172   .0380633    -1.67   0.103    -.1403876
>> >> .0133532
>> >>        _cons |   2.404044   .8235133     2.92   0.006     .7409252
>> >> 4.067163
>> >> -------------+----------------------------------------------------------------
>> >>      sigma_u |  .95115353
>> >>      sigma_e |  .03719725
>> >>          rho |  .99847294   (fraction of variance due to u_i)
>> >> ------------------------------------------------------------------------------
>> >> F test that all u_i=0:     F(9, 41) =   755.95               Prob >
>> F
>> >> = 0.0000
>> >>
>> >> . xtreg ly lx1 lx2 lx3 lx4 lx5 lx6, be
>> >>
>> >> Carrying out a fixed effects between regression on panel data
>> >>
>> >>
>> >> Between regression (regression on group means)  Number of obs      =
>> >>      57
>> >> Group variable (i): country                     Number of groups
>> =
>> >>      10
>> >>
>> >> R-sq:  within  = 0.0790                         Obs per group: min
>> =
>> >>       2
>> >>        between = 0.9488                                        avg
>> =
>> >>     5.7
>> >>        overall = 0.7682                                        max
>> =
>> >>       8
>> >>
>> >>                                                 F(6,3)
>> =
>> >>    9.26
>> >> sd(u_i + avg(e_i.))=  .4441503                  Prob > F
>> =
>> >>  0.0477
>> >>
>> >> ------------------------------------------------------------------------------
>> >>           ly |      Coef.   Std. Err.      t    P>|t|     [95%
>> Conf. Interval]
>> >> -------------+----------------------------------------------------------------
>> >>          lx1 |   .5188441   .2315068     2.24   0.111    -.2179138
>> >> 1.255602
>> >>          lx2 |  -.0061883   .4172493    -0.01   0.989    -1.334062
>> >> 1.321685
>> >>          lx3 |   .1313838   4.684306     0.03   0.979    -14.77617
>> >> 15.03894
>> >>          lx4 |   .9508895   .2441334     3.89   0.030      .173948
>> >> 1.727831
>> >>          lx5 |   7.621178   7.059213     1.08   0.359    -14.84439
>> >> 30.08674
>> >>          lx6 |   -.672947   1.417266    -0.47   0.667    -5.183319
>> >> 3.837425
>> >>        _cons |  -26.37744   19.85242    -1.33   0.276     -89.5567
>> >> 36.80181
>> >> ------------------------------------------------------------------------------
>> >>
>> >> . xtreg ly lx1 lx2 lx3 lx4 lx5 lx6, re
>> >>
>> >> Carrying out a random effects regression on panel data
>> >>
>> >>
>> >> Random-effects GLS regression                   Number of obs      =
>> >>      57
>> >> Group variable (i): country                     Number of groups
>> =
>> >>      10
>> >>
>> >> R-sq:  within  = 0.7556                         Obs per group: min
>> =
>> >>       2
>> >>        between = 0.6683                                        avg
>> =
>> >>     5.7
>> >>        overall = 0.6327                                        max
>> =
>> >>       8
>> >>
>> >> Random effects u_i ~ Gaussian                   Wald chi2(6)
>> =
>> >>   94.90
>> >> corr(u_i, X)       = 0 (assumed)                Prob > chi2        =
>> >>  0.0000
>> >>
>> >> ------------------------------------------------------------------------------
>> >>           ly |      Coef.   Std. Err.      z    P>|z|     [95%
>> Conf. Interval]
>> >> -------------+----------------------------------------------------------------
>> >>          lx1 |  -.0065896   .0077505    -0.85   0.395    -.0217803
>> >> .0086011
>> >>          lx2 |   .1253869   .0257565     4.87   0.000     .0749051
>> >> .1758687
>> >>          lx3 |  -.0363082   .0969763    -0.37   0.708    -.2263783
>> >> .1537619
>> >>          lx4 |   .1554292    .061983     2.51   0.012     .0339448
>> >> .2769135
>> >>          lx5 |   .4387479   .2031582     2.16   0.031     .0405652
>> >> .8369306
>> >>          lx6 |  -.0456517   .0477556    -0.96   0.339    -.1392509
>> >> .0479475
>> >>        _cons |   2.241371   1.053202     2.13   0.033     .1771336
>> >> 4.305609
>> >> -------------+----------------------------------------------------------------
>> >>      sigma_u |  .44383293
>> >>      sigma_e |  .03719725
>> >>          rho |  .99302502   (fraction of variance due to u_i)
>> >> ------------------------------------------------------------------------------
>> >> Fixed-effects (within) regression               Number of obs      =
>> >>      57
>> >> Group variable (i): country                     Number of groups
>> =
>> >>      10
>> >>
>> >> R-sq:  within  = 0.7640                         Obs per group: min
>> =
>> >>       2
>> >>        between = 0.5507                                        avg
>> =
>> >>     5.7
>> >>        overall = 0.5374                                        max
>> =
>> >>       8
>> >>
>> >>                                                 F(6,41)            =
>> >>   22.12
>> >> corr(u_i, Xb)  = 0.5835                         Prob > F
>> =
>> >>  0.0000
>> >>
>> >> ------------------------------------------------------------------------------
>> >>           ly |      Coef.   Std. Err.      t    P>|t|     [95%
>> Conf. Interval]
>> >> -------------+----------------------------------------------------------------
>> >>          lx1 |  -.0075411   .0061342    -1.23   0.226    -.0199293
>> >> .0048472
>> >>          lx2 |   .1397473   .0208394     6.71   0.000     .0976612
>> >> .1818334
>> >>          lx3 |  -.0471179   .0766965    -0.61   0.542    -.2020095
>> >> .1077738
>> >>          lx4 |   .0883038   .0510516     1.73   0.091    -.0147971
>> >> .1914046
>> >>          lx5 |   .4423916   .1609951     2.75   0.009     .1172554
>> >> .7675278
>> >>          lx6 |  -.0635172   .0380633    -1.67   0.103    -.1403876
>> >> .0133532
>> >>        _cons |   2.404044   .8235133     2.92   0.006     .7409252
>> >> 4.067163
>> >> -------------+----------------------------------------------------------------
>> >>      sigma_u |  .95115353
>> >>      sigma_e |  .03719725
>> >>          rho |  .99847294   (fraction of variance due to u_i)
>> >> ------------------------------------------------------------------------------
>> >> F test that all u_i=0:     F(9, 41) =   755.95               Prob >
>> F
>> >> = 0.0000
>> >>
>> >> . estimates store fixed
>> >>
>> >> . xtreg ly lx1 lx2 lx3 lx4 lx5 lx6, re
>> >>
>> >> Random-effects GLS regression                   Number of obs      =
>> >>      57
>> >> Group variable (i): country                     Number of groups
>> =
>> >>      10
>> >>
>> >> R-sq:  within  = 0.7556                         Obs per group: min
>> =
>> >>       2
>> >>        between = 0.6683                                        avg
>> =
>> >>     5.7
>> >>        overall = 0.6327                                        max
>> =
>> >>       8
>> >>
>> >> Random effects u_i ~ Gaussian                   Wald chi2(6)
>> =
>> >>   94.90
>> >> corr(u_i, X)       = 0 (assumed)                Prob > chi2        =
>> >>  0.0000
>> >>
>> >> ------------------------------------------------------------------------------
>> >>           ly |      Coef.   Std. Err.      z    P>|z|     [95%
>> Conf. Interval]
>> >> -------------+----------------------------------------------------------------
>> >>          lx1 |  -.0065896   .0077505    -0.85   0.395    -.0217803
>> >> .0086011
>> >>          lx2 |   .1253869   .0257565     4.87   0.000     .0749051
>> >> .1758687
>> >>          lx3 |  -.0363082   .0969763    -0.37   0.708    -.2263783
>> >> .1537619
>> >>          lx4 |   .1554292    .061983     2.51   0.012     .0339448
>> >> .2769135
>> >>          lx5 |   .4387479   .2031582     2.16   0.031     .0405652
>> >> .8369306
>> >>          lx6 |  -.0456517   .0477556    -0.96   0.339    -.1392509
>> >> .0479475
>> >>        _cons |   2.241371   1.053202     2.13   0.033     .1771336
>> >> 4.305609
>> >> -------------+----------------------------------------------------------------
>> >>      sigma_u |  .44383293
>> >>      sigma_e |  .03719725
>> >>          rho |  .99302502   (fraction of variance due to u_i)
>> >> ------------------------------------------------------------------------------
>> >>
>> >> . estimates store random
>> >>
>> >> Carrying out a HAUSMAN TEST
>> >>
>> >> . hausman fixed random
>> >>
>> >>                  ---- Coefficients ----
>> >>              |      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
>> >>              |     fixed        random       Difference          S.E.
>> >> -------------+----------------------------------------------------------------
>> >>          lx1 |   -.0075411    -.0065896       -.0009515
>> >> .
>> >>          lx2 |    .1397473     .1253869        .0143604
>> >> .
>> >>          lx3 |   -.0471179    -.0363082       -.0108097
>> >> .
>> >>          lx4 |    .0883038     .1554292       -.0671254
>> >> .
>> >>          lx5 |    .4423916     .4387479        .0036437
>> >> .
>> >>          lx6 |   -.0635172    -.0456517       -.0178655
>> >> .
>> >> ------------------------------------------------------------------------------
>> >>                            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(6) = (b-B)'[(V_b-V_B)^(-1)](b-B)
>> >>                           =    -4.12    chi2<0 ==> model fitted on
>> these
>> >>                                         data fails to meet the asymptotic
>> >>                                         assumptions of the Hausman
>> test;
>> >>                                         see suest for a generalized
>> test
>> >>
>> >> *
>> >> *   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/
>

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