Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: OLS, FE xtreg and the i() option


From   "Gustavo Sanchez" <gsanchez@stata.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: OLS, FE xtreg and the i() option
Date   Wed, 2 Mar 2005 12:34:08 -0600

Robert [robboh@gmail.com] asked:

>I have been working on a panel dataset, looking at the relationship
>between inflation and openness, but am slightly confused at to the
>results I have been finding.  When running OLS and Fixed-Effects (FE)
>estimations completely different results are found.  However, when the
>i() option for the FE estimation is set to the year (which it
>shouldn't be; it should be the country code), the panel data results
>are almost exactly equal to OLS.

>Am I making an error in my use of Stata, or is this a kind of
>'pooling' (when setting i() to the year), implying that the 'correct'
>value is as found by the 'correct' FE estimation.  I have not been
>able to find any direct information on this in the Stata documentation
>or the net in general - any comments that you can give will be much
>appreciated.

Fixed effects using -xtreg,fe- and OLS using -regress- including the
dummy variables produce the same slope parameters for the explanatory
variables (see the example below).
Are you including the dummy variables in your OLS regression?

Here is the example:

. sysuse auto,clear
(1978 Automobile Data)

. xtreg price mpg weight,fe i(rep78)

Fixed-effects (within) regression               Number of obs      =
69
Group variable (i): rep78                       Number of groups   =
5

R-sq:  within  = 0.3591                         Obs per group: min =
2
       between = 0.0002                                        avg =
13.8
       overall = 0.2994                                        max =
30

                                                F(2,62)            =
17.37
corr(u_i, Xb)  = -0.4414                        Prob > F           =
0.0000
----------------------------------------------------------------------------
--
       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf.
Interval]
-------------+--------------------------------------------------------------
--
         mpg |   -63.0971   87.45276    -0.72   0.473    -237.9127
111.7185
      weight |   2.093066    .636901     3.29   0.002     .8199193
3.366213
       _cons |   1143.134   3565.726     0.32   0.750     -5984.65
8270.918
-------------+--------------------------------------------------------------
--
     sigma_u |  1287.8103
     sigma_e |   2424.057
         rho |  .22011463   (fraction of variance due to u_i)
----------------------------------------------------------------------------
--
F test that all u_i=0:     F(4, 62) =     1.66               Prob > F =
0.1707

. xi:regress price mpg weight i.rep78
i.rep78           _Irep78_1-5         (naturally coded; _Irep78_1 omitted)

      Source |       SS       df       MS              Number of obs =
69
-------------+------------------------------           F(  6,    62) =
6.03
       Model |   212481723     6  35413620.6           Prob > F      =
0.0001
    Residual |   364315236    62  5876052.19           R-squared     =
0.3684
-------------+------------------------------           Adj R-squared =
0.3073
       Total |   576796959    68  8482308.22           Root MSE      =
2424.1

----------------------------------------------------------------------------
--
       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf.
Interval]
-------------+--------------------------------------------------------------
--
         mpg |   -63.0971   87.45276    -0.72   0.473    -237.9127
111.7185
      weight |   2.093066    .636901     3.29   0.002     .8199193
3.366213
   _Irep78_2 |   753.7024   1919.763     0.39   0.696    -3083.849
4591.254
   _Irep78_3 |   1349.361   1772.706     0.76   0.449    -2194.228
4892.95
   _Irep78_4 |    2030.47    1810.09     1.12   0.266    -1587.848
5648.788
   _Irep78_5 |    3376.91    1900.17     1.78   0.080    -421.4749
7175.296
       _cons |  -598.9665   3960.904    -0.15   0.880    -8516.701
7318.768
----------------------------------------------------------------------------
--

Sincerely,

--Gustavo
gas@stata.com



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