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

Re: st: RE: Fixed Effects Panel Regression with correlation between panels


From   "Scott Merryman" <smerryman@kc.rr.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: RE: Fixed Effects Panel Regression with correlation between panels
Date   Sat, 21 Jun 2003 07:31:41 -0500

----- Original Message ----- 
From: "ash_alankar" <ash_alankar@yahoo.com>
To: <statalist@hsphsun2.harvard.edu>
Sent: Thursday, June 19, 2003 4:57 PM
Subject: Re: st: RE: Fixed Effects Panel Regression with correlation between
panels


> Hi Dolores,
>
> Thanks for the info.  But when I mean correlation between panels I
> mean that the errors for unit i are correlated with the errors for
> unit j.  I am assuming that the errors are independent across time
> i.e. no autocorrelation.
>
> Do you know how to do this in a fixed effects framework?  I was
> thinking of using xtgls with a dummy of ones for each different unit
> to capture the fixed effects, but was hoping that there might be a
> better way.
>
> Thanks.
> Ash.


A possible alternative to fixed effects GLS would be to reshape the data and
use -sureg-.  If you constrain the coefficients to be equal across
equations, it will give you the same results fixed effects GLS, however,
sureg would allow the slope coefficients to vary by equation as well as
contemporaneous correlation between the error terms across equations.

Hope this helps,
Scott


Example:

The do file:
preserve
use http://www.stata-press.com/data/r8/grunfeld.dta
drop kstock
keep if comp <4

xtreg invest mvalue , fe

xi i.com
xtgls invest mva _*, panel(corr)

drop _*

reshape wide invest mvalue , i(year)  j(company)
forv i  = 1/3 {
 local  rhs " `rhs' (invest`i'  mvalue`i'  )"
 }
di "`rhs'"

constraint 1  [invest1]mvalue1 = [invest2]mvalue2
constrain 2 [invest2]mvalue2 = [invest3]mvalue3
sureg `rhs' ,const(1 2) corr

restore

The results:

. preserve

. use http://www.stata-press.com/data/r8/grunfeld.dta

. drop kstock

. keep if comp <4
(140 observations deleted)

.
. xtreg invest mvalue , fe

Fixed-effects (within) regression               Number of obs      =
60
Group variable (i): company                     Number of groups   =
3

R-sq:  within  = 0.3725                         Obs per group: min =
20
       between = 0.6451                                        avg =
20.0
       overall = 0.5131                                        max =
20

                                                F(1,56)            =
33.25
corr(u_i, Xb)  = -0.3598                        Prob > F           =
0.0000

----------------------------------------------------------------------------
--
      invest |      Coef.   Std. Err.      t    P>|t|     [95% Conf.
Interval]
-------------+--------------------------------------------------------------
--
      mvalue |   .1982563   .0343844     5.77   0.000     .1293759
.2671366
       _cons |  -171.4112   96.63739    -1.77   0.082    -364.9991
22.17679
-------------+--------------------------------------------------------------
--
     sigma_u |  166.11924
     sigma_e |  155.73559
         rho |  .53222836   (fraction of variance due to u_i)
----------------------------------------------------------------------------
--
F test that all u_i=0:     F(2, 56) =    19.81               Prob > F =
0.0000

.
. xi i.com
i.company         _Icompany_1-3       (naturally coded; _Icompany_1 omitted)

. xtgls invest mva _*, panel(corr)

Cross-sectional time-series FGLS regression

Coefficients:  generalized least squares
Panels:        heteroskedastic with cross-sectional correlation
Correlation:   no autocorrelation

Estimated covariances      =         6          Number of obs      =
60
Estimated autocorrelations =         0          Number of groups   =
3
Estimated coefficients     =         4          Time periods       =
20
                                                Wald chi2(3)       =
244.45
Log likelihood             = -362.3947          Prob > chi2        =
0.0000

----------------------------------------------------------------------------
--
      invest |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+--------------------------------------------------------------
--
      mvalue |   .1166626   .0323914     3.60   0.000     .0531767
.1801485
 _Icompany_2 |   78.01431   86.04438     0.91   0.365    -90.62957
246.6582
 _Icompany_3 |  -226.6125   89.96582    -2.52
.012    -402.9423    -50.2827
       _cons |   102.4225   149.0675     0.69   0.492    -189.7444
394.5895
----------------------------------------------------------------------------
--

.
. drop _*

.
. reshape wide invest mvalue , i(year)  j(company)
(note: j = 1 2 3)

Data                               long   ->   wide
----------------------------------------------------------------------------
-
Number of obs.                       60   ->      20
Number of variables                   5   ->       8
j variable (3 values)           company   ->   (dropped)
xij variables:
                                 invest   ->   invest1 invest2 invest3
                                 mvalue   ->   mvalue1 mvalue2 mvalue3
----------------------------------------------------------------------------
-

. forv i  = 1/3 {
  2.         local  rhs " `rhs' (invest`i'  mvalue`i'  )"
  3.         }

. di "`rhs'"
    (invest1  mvalue1  ) (invest2  mvalue2  ) (invest3  mvalue3  )

.
. constraint 1  [invest1]mvalue1 = [invest2]mvalue2

. constrain 2 [invest2]mvalue2 = [invest3]mvalue3

. sureg `rhs' ,const(1 2) corr

Seemingly unrelated regression

Constraints:
 ( 1)  [invest1]mvalue1 - [invest2]mvalue2 = 0
 ( 2)  [invest2]mvalue2 - [invest3]mvalue3 = 0
----------------------------------------------------------------------
Equation          Obs  Parms        RMSE    "R-sq"       chi2        P
----------------------------------------------------------------------
invest1            20      1    244.2778    0.3446      12.97   0.0003
invest2            20      1    109.6837    0.1947      12.97   0.0003
invest3            20      1     55.1047   -0.3541      12.97   0.0003
----------------------------------------------------------------------

----------------------------------------------------------------------------
--
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+--------------------------------------------------------------
--
invest1      |
     mvalue1 |   .1166626   .0323914     3.60   0.000     .0531767
.1801485
       _cons |   102.4225   149.0675     0.69   0.492    -189.7444
394.5895
-------------+--------------------------------------------------------------
--
invest2      |
     mvalue2 |   .1166626   .0323914     3.60   0.000     .0531767
.1801485
       _cons |   180.4368   68.18261     2.65   0.008     46.80137
314.0723
-------------+--------------------------------------------------------------
--
invest3      |
     mvalue3 |   .1166626   .0323914     3.60   0.000     .0531767
.1801485
       _cons |    -124.19   65.30971    -1.90   0.057    -252.1946
3.814733
----------------------------------------------------------------------------
--

Correlation matrix of residuals:

         invest1  invest2  invest3
invest1   1.0000
invest2   0.6410   1.0000
invest3   0.4171   0.5185   1.0000

Breusch-Pagan test of independence: chi2(3) =    17.076, Pr = 0.0007

.
. restore


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