# 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 Thu, 26 Feb 2009 21:40:58 +0000

```Thanks Kirimi, Just to explain. The question I want to answer is that
if variable lx2 has a statistically significant impact on my dependant
variable ly.

My model is:  ln GDPit = â0it + â1 ln FDI it  + â2 InTRP it + â3 ln
NBT it  + â4 SEC it + â5 EFI it + â6 GFCit + eit (Equation 1)

GDP = Gross domestic Product
FDI = Foreign Direct Investment
TRP= Tourism receipts
NBT= Net Barter terms of Trade
SEC= % Children in secondary education
EFI = Economic Freedom Index
GFC = Gross Fixed Capital as a % of GDP

I have 12 Sub-Saharan african Countries, so from my basic
understanding of econometrics, I don't think I will have a problem
with heterogeneity? Please correct me if I am wrong.

How would I be able to tell if I am having data problems from the
pooled data, and why will the within effects not show me much (I
thought the  fixed effects within estimator is usually the more
appropriate method?

Kind Regards,

Mohammud

On Thu, Feb 26, 2009 at 9:24 PM, Kirimi Sindi <sindijul@msu.edu> wrote:
> Malik,
>
> Running models is okay but you have to ask yourself what question you want
> to answer first. Then the next question is the type of data you have to
> enable you answer the question. Then the assumption you make about the data.
> Does the data have unobserved heterogeneity and is this heterogeneity
> corrected with the X's or not. That helps you choose between RE of FE. I
> guess within does not tell you much. But I guess you have started well by
> running a pooled model. Then look at the results and ask yourself what could
> be going on? Is it an artifact of the data. Do you have data problems.
>
> Then move on.
>
> Kirimi
>
>>
>> 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
>>  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/
>>
>>
>>
>
> --
> *******************************
> Imagination is more important than knowledge. For while knowledge defines
> all we currently know and understand, imagination points to all we might yet
> discover and create.
> *******************************
>
> Kirimi Sindi
> PhD Candidate
> Department of Agricultural,
> Food, and Resource Economics
> Room 20 Cook Hall
> Michigan State University
> East Lansing,  MI  48824
> Telephone: +1-517-353-5320
> Home Tel : +1-517-355-8151
> Fax: +1-517-432-1800
>
> *
> *   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/
```