Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Hausman test, panel data, fixed- and random-effects


From   "Laura Flamand" <laura.flamand@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Hausman test, panel data, fixed- and random-effects
Date   Thu, 30 Aug 2007 11:29:50 -0700

Dear all,

I am estimating panel data models to study the effects of the policies
of air pollution (ifga, presprop) over the concentration of two
important pollutants (sulfur dioxide, so2, and nitrogen dioxide, no2)
in four Mexican cities in a period of more than ten years (note that
the panels are unbalanced), that is T>N.

I have reason to believe that some omitted variables may be constant
over time but vary between cases, and others may be fixed between
cases but vary over time, so I decided to use a panel data model with
random effects, most likely I would end up using a pcse specification,
due to the heteroskedasticity present in the data. However, I have had
problems when performing the Hausman test to decide between a
fixed-effects specification and a random-effects specification, the
output appears below (I have include both the fixed-effects,
random-effects, and the Hausman tests). Is part of the problem that I
have too few observations? As always, any suggestions would be very
much appreciated.

Laura




. summarize so2 no2 presprop vehiculos pbtdef ifga energia



    Variable |       Obs        Mean    Std. Dev.       Min        Max

-------------+--------------------------------------------------------

         so2 |        46    .0113261    .0035966       .006        .02

         no2 |        47    .0264255    .0095548       .011       .047

    presprop |        45    16.41439    5.584965   6.650289   27.13052

   vehiculos |        44     1372728     1450837      96795    4622148

      pbtdef |        44    2.20e+08    1.80e+08   6.43e+07   5.63e+08

-------------+--------------------------------------------------------

        ifga |        48    5.491667    2.288624         .6        8.7

     energia |        32    3018.091    2470.169        329     8095.6



.

. **RANDOM EFFECTS**

. * so2

. xtreg so2 pbtdef energia presprop ifga, re



Random-effects GLS regression                   Number of obs      =        25

Group variable (i): clave                       Number of groups   =         4



R-sq:  within  = 0.1190                         Obs per group: min =         5

       between = 0.9060                                        avg =       6.3

       overall = 0.6031                                        max =         7



Random effects u_i ~ Gaussian                   Wald chi2(4)       =     13.58

corr(u_i, X)       = 0 (assumed)                Prob > chi2         =
  0.0088



------------------------------------------------------------------------------

         so2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]

-------------+----------------------------------------------------------------

      pbtdef |   7.66e-12   2.66e-12     2.88   0.004     2.44e-12    1.29e-11

     energia |  -6.63e-07   1.93e-07    -3.43   0.001    -1.04e-06   -2.84e-07

    presprop |   .0000842   .0000871     0.97   0.334    -.0000865    .0002549

        ifga |  -.0000724   .0001829    -0.40   0.692    -.0004308     .000286

       _cons |   .0105937   .0018532     5.72   0.000     .0069615    .0142258

-------------+----------------------------------------------------------------

     sigma_u |          0

     sigma_e |  .00173762

         rho |          0   (fraction of variance due to u_i)

------------------------------------------------------------------------------





. * no2

. xtreg no2 pbtdef vehiculos presprop ifga, re



Random-effects GLS regression                   Number of obs      =        38

Group variable (i): clave                       Number of groups   =         4



R-sq:  within  = 0.0011                         Obs per group: min =         8

       between = 0.8323                                        avg =       9.5

       overall = 0.2759                                        max =        10



Random effects u_i ~ Gaussian                   Wald chi2(4)       =     12.05

corr(u_i, X)       = 0 (assumed)                Prob > chi2         =
  0.0170



------------------------------------------------------------------------------

         no2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]

-------------+----------------------------------------------------------------

      pbtdef |  -6.81e-11   2.76e-11    -2.47   0.014    -1.22e-10   -1.40e-11

   vehiculos |   8.57e-09   3.44e-09     2.49   0.013     1.83e-09    1.53e-08

    presprop |  -.0004293   .0003159    -1.36   0.174    -.0010486    .0001899

        ifga |  -.0000494   .0006242    -0.08   0.937    -.0012727     .001174

       _cons |   .0357281   .0072433     4.93   0.000     .0215314    .0499248

-------------+----------------------------------------------------------------

     sigma_u |          0

     sigma_e |  .00375932

         rho |          0   (fraction of variance due to u_i)

------------------------------------------------------------------------------





. **FIXED EFFECTS**

. xtreg so2 pbtdef energia presprop ifga, fe



Fixed-effects (within) regression               Number of obs      =        25

Group variable (i): clave                       Number of groups   =         4



R-sq:  within  = 0.3789                         Obs per group: min =         5

       between = 0.6553                                        avg =       6.3

       overall = 0.2823                                        max =         7



                                                F(4,17)            =      2.59

corr(u_i, Xb)  = -0.9710                        Prob > F           =    0.0737



------------------------------------------------------------------------------

         so2 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]

-------------+----------------------------------------------------------------

      pbtdef |  -3.71e-11   3.33e-11    -1.11   0.281    -1.07e-10    3.32e-11

     energia |   2.81e-09   6.75e-07     0.00   0.997    -1.42e-06    1.43e-06

    presprop |   .0000724   .0000729     0.99   0.335    -.0000814    .0002262

        ifga |  -.0005388   .0002206    -2.44   0.026    -.0010042   -.0000735

       _cons |   .0202899   .0061256     3.31   0.004     .0073659    .0332138

-------------+----------------------------------------------------------------

     sigma_u |  .01084947

     sigma_e |  .00173762

         rho |  .97499118   (fraction of variance due to u_i)

------------------------------------------------------------------------------

F test that all u_i=0:     F(3, 17) =     4.02               Prob > F = 0.0249



. est store fixedso2ener



.

. * no2

. xtreg no2 pbtdef vehiculos presprop ifga, fe



Fixed-effects (within) regression               Number of obs      =        38

Group variable (i): clave                       Number of groups   =         4



R-sq:  within  = 0.3340                         Obs per group: min =         8

       between = 0.0534                                        avg =       9.5

       overall = 0.0221                                        max =        10



                                                F(4,30)            =      3.76

corr(u_i, Xb)  = -0.9059                        Prob > F            =
  0.0135



------------------------------------------------------------------------------

         no2 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]

-------------+----------------------------------------------------------------

      pbtdef |  -5.42e-11   3.90e-11    -1.39   0.175    -1.34e-10    2.54e-11

   vehiculos |  -6.49e-09   2.31e-09    -2.81   0.009    -1.12e-08   -1.78e-09

    presprop |  -.0002618    .000137    -1.91   0.066    -.0005415    .0000179

        ifga |   .0007199   .0004104     1.75   0.090    -.0001182     .001558

       _cons |   .0456466   .0097798     4.67   0.000     .0256735    .0656197

-------------+----------------------------------------------------------------

     sigma_u |  .02521944

     sigma_e |  .00375932

         rho |  .97826279   (fraction of variance due to u_i)

------------------------------------------------------------------------------

F test that all u_i=0:     F(3, 30) =    49.23                Prob > F
= 0.0000



. est store fixedno2



.

.

. **RANDOM EFFECTS - HAUSMAN**

.

. hausman fixedso2ener randomso2ener



Note: the rank of the differenced variance matrix (3) does not equal
the number of coefficients being tested (4); be sure this is what

        you expect, or there may be problems computing the test.
Examine the output of your estimators for anything unexpected and

        possibly consider scaling your variables so that the
coefficients are on a similar scale.



                 ---- Coefficients ----

             |      (b)          (B)             (b-B)     sqrt(diag(V_b-V_B))

             |  fixedso2ener randomso2e~r    Difference          S.E.

-------------+----------------------------------------------------------------

      pbtdef |   -3.71e-11     7.66e-12       -4.48e-11        3.32e-11

     energia |    2.81e-09    -6.63e-07        6.66e-07        6.47e-07

    presprop |    .0000724     .0000842       -.0000118               .

        ifga |   -.0005388    -.0000724       -.0004665        .0001233

------------------------------------------------------------------------------

                           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(3) = (b-B)'[(V_b-V_B)^(-1)](b-B)

                          =       18.27

                Prob>chi2 =      0.0004

                (V_b-V_B is not positive definite)



. hausman fixedno2 randomno2



Note: the rank of the differenced variance matrix (2) does not equal
the number of coefficients being tested (4); be sure this is what

        you expect, or there may be problems computing the test.
Examine the output of your estimators for anything unexpected and

        possibly consider scaling your variables so that the
coefficients are on a similar scale.



                 ---- Coefficients ----

             |      (b)          (B)             (b-B)     sqrt(diag(V_b-V_B))

             |    fixedno2    randomno2      Difference          S.E.

-------------+----------------------------------------------------------------

      pbtdef |   -5.42e-11    -6.81e-11        1.39e-11        2.76e-11

   vehiculos |   -6.49e-09     8.57e-09       -1.51e-08               .

    presprop |   -.0002618    -.0004293        .0001675               .

        ifga |    .0007199    -.0000494        .0007693               .

------------------------------------------------------------------------------

                           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(2) = (b-B)'[(V_b-V_B)^(-1)](b-B)

                          =    -2.78    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/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index