Example of SUR estimation with panel data

. drop caar clar firmnr t1 t2 t3 t4 t5 t6

. reshape wide roe lev tobq cbeta, i(cusip) j(yearptr)
(note:  j = 0 1 2 3 4 5 6)

Data                               wide   ->  long
-----------------------------------------------------------------------------
Number of obs.                      350   ->      50
Number of variables                   6   ->      29
j variable (7 values)           yearptr   ->   (dropped)
xij variables:
                                    roe   ->   roe0 roe1 ... roe6
                                    lev   ->   lev0 lev1 ... lev6
                                   tobq   ->   tobq0 tobq1 ... tobq6
                                  cbeta   ->   cbeta0 cbeta1 ... cbeta6
-----------------------------------------------------------------------------

. summ

Variable |     Obs        Mean   Std. Dev.       Min        Max
---------+-----------------------------------------------------
   cusip |      50      469349   278445.4       1688     963320  
  cbeta0 |      50      1.0042   .2164471        .54       1.65  
    roe0 |      50    3.883854   7.862105   -20.0409    16.5186  
   tobq0 |      50    1.076708   .4774362       .569     3.1185  
    lev0 |      50      .35977   .4819179      .0026     3.2347  
  cbeta1 |      50      1.0278   .2903853        .29       2.27  
    roe1 |      50    6.196632   5.610777   -10.1931    22.1943  
   tobq1 |      50    1.007064   .4477677       .457     2.9761  
    lev1 |      50      .50814   .6496168      .0117     4.1957  
  cbeta2 |      50      1.0594   .3326051        .29       2.27  
    roe2 |      50     6.13169   5.589205    -8.0833    23.9925  
   tobq2 |      50     .953862   .3883063      .4298     2.3539  
    lev2 |      50     .615938   1.347538       .013      9.605  
  cbeta3 |      50      1.0098   .2935601        .29       2.27  
    roe3 |      50    5.526766   6.041315   -10.8963    22.5864  
   tobq3 |      50     .949924   .4558494      .4555     2.9094  
    lev3 |      50     .498612   .5469398      .0122     2.5907  
  cbeta4 |      50       1.022   .2492847        .29          2  
    roe4 |      50    3.744152   6.185379   -17.8136    19.2118  
   tobq4 |      50     .967758   .6017065      .4462     3.9244  
    lev4 |      50      .47525   .4761417       .015      2.407  
  cbeta5 |      50        .993    .230317        .29        1.7  
    roe5 |      50    4.291354   6.042261   -18.0329    13.7559  
   tobq5 |      50     .967456   .6110386      .4097     4.0775  
    lev5 |      50     .437304    .471578      .0041     2.3096  
  cbeta6 |      50       .9696   .2216079        .29       1.65  
    roe6 |      50    2.687956   7.497477   -13.8009    19.8513  
   tobq6 |      50     .933072   .4531542      .4336     2.6555  
    lev6 |      50     .520916   .6245689      .0034     3.6092  


. eq  roe0 lev0 tobq0 cbeta0

. eq  roe1 lev1 tobq1 cbeta1

. eq  roe2 lev2 tobq2 cbeta2

. eq  roe3 lev3 tobq3 cbeta3

. eq  roe4 lev4 tobq4 cbeta4

. eq  roe5 lev5 tobq5 cbeta5

. eq  roe6 lev6 tobq6 cbeta6

. sureg roe0 roe1 roe2 roe3 roe4 roe5 roe6

Equation      Obs  Parms        RMSE    "R-sq"          F        P
------------------------------------------------------------------
 roe0          50      4    5.502964    0.5401      22.62   0.0000
 roe1          50      4    4.099582    0.4988   15.62957   0.0000
 roe2          50      4    3.816528    0.5623   19.84451   0.0000
 roe3          50      4    4.969317    0.3648   9.090408   0.0000
 roe4          50      4    4.760276    0.4440   14.49972   0.0000
 roe5          50      4    5.024527    0.3508   8.718406   0.0000
 roe6          50      4    3.868607    0.7501   61.73442   0.0000

------------------------------------------------------------------------------
         |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
roe0     |
    lev0 |  -5.200336   1.628849     -3.193   0.002      -8.404866   -1.995807
   tobq0 |   10.33629   1.819211      5.682   0.000       6.757255    13.91533
  cbeta0 |  -9.901678   3.483853     -2.842   0.005      -16.75567   -3.047689
   _cons |   4.568874   3.502497      1.304   0.193      -2.321793    11.45954
---------+--------------------------------------------------------------------
roe1     |
    lev1 |  -2.098479    .855281     -2.454   0.015      -3.781124   -.4158349
   tobq1 |   6.806053   1.323821      5.141   0.000       4.201623    9.410484
  cbeta1 |  -.2608589   1.855424     -0.141   0.888      -3.911142    3.389425
   _cons |   .6769329   2.172655      0.312   0.756      -3.597457    4.951323
---------+--------------------------------------------------------------------
roe2     |
    lev2 |  -.5118847   .3442075     -1.487   0.138      -1.189064    .1652948
   tobq2 |   9.397844    1.28108      7.336   0.000         6.8775    11.91819
  cbeta2 |  -1.317951   1.331242     -0.990   0.323      -3.936982    1.301079
   _cons |   -1.12103   1.764974     -0.635   0.526      -4.593367    2.351308
---------+--------------------------------------------------------------------
roe3     |
    lev3 |  -3.656251   1.053165     -3.472   0.001      -5.728204   -1.584297
   tobq3 |    5.39683    1.78578      3.022   0.003        1.88356      8.9101
  cbeta3 |  -2.337329   2.679809     -0.872   0.384      -7.609474    2.934817
   _cons |   4.583473   2.416172      1.897   0.059      -.1700047     9.33695
---------+--------------------------------------------------------------------
roe4     |
    lev4 |  -7.865786   1.376174     -5.716   0.000      -10.57321   -5.158359
   tobq4 |    3.27522   1.318337      2.484   0.013       .6815774    5.868862
  cbeta4 |  -8.865709   3.125976     -2.836   0.005      -15.01563   -2.715793
   _cons |    13.3735   3.122147      4.283   0.000       7.231118    19.51588
---------+--------------------------------------------------------------------
roe5     |
    lev5 |  -5.892689   1.375226     -4.285   0.000      -8.598252   -3.187125
   tobq5 |    2.44463   1.305694      1.872   0.062      -.1241373    5.013398
  cbeta5 |  -4.739855   3.151931     -1.504   0.134      -10.94083    1.461122
   _cons |   9.209854   3.033937      3.036   0.003       3.241012     15.1787
---------+--------------------------------------------------------------------
roe6     |
    lev6 |  -4.154991   .8099786     -5.130   0.000       -5.74851   -2.561473
   tobq6 |   12.25611   1.284525      9.541   0.000       9.728983    14.78323
  cbeta6 |  -6.218179   2.213325     -2.809   0.005      -10.57258   -1.863774
   _cons |  -.5543249   2.279129     -0.243   0.808      -5.038189     3.92954
------------------------------------------------------------------------------


. which reg3
~:Stata:ado:reg3.ado
*! version 1.0.0  07Oct1997  Statalist distribution

. reg3 roe0 roe1 roe2 roe3 roe4 roe5 roe6

Three-stage regression results
------------------------------------------------------------------
Equation      Obs  Parms        RMSE    "R-sq"       Chi2        P
------------------------------------------------------------------
 roe0          50      3    5.305504    0.5353      73.76   0.0000
 roe1          50      3    4.135927    0.4455      50.97   0.0000
 roe2          50      3    3.989091    0.4802      64.71   0.0000
 roe3          50      3    4.956471    0.3132      29.64   0.0000
 roe4          50      3    4.607001    0.4339      47.28   0.0000
 roe5          50      3    4.913361    0.3253      28.43   0.0000
 roe6          50      3    3.726577    0.7479     201.31   0.0000
------------------------------------------------------------------
------------------------------------------------------------------------------
         |      Coef.   Std. Err.       z     P>|z|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
roe0     |
    lev0 |  -5.200336   1.562337     -3.329   0.001       -8.26246   -2.138212
   tobq0 |   10.33629   1.744925      5.924   0.000       6.916303    13.75629
  cbeta0 |  -9.901678   3.341595     -2.963   0.003      -16.45108   -3.352273
   _cons |   4.568874   3.359477      1.360   0.174       -2.01558    11.15333
---------+--------------------------------------------------------------------
roe1     |
    lev1 |  -2.098479   .8203567     -2.558   0.011      -3.706349   -.4906096
   tobq1 |   6.806053   1.269764      5.360   0.000       4.317361    9.294746
  cbeta1 |  -.2608588    1.77966     -0.147   0.883      -3.748928     3.22721
   _cons |   .6769328   2.083937      0.325   0.745      -3.407509    4.761374
---------+--------------------------------------------------------------------
roe2     |
    lev2 |  -.5118847   .3301522     -1.550   0.121      -1.158971    .1352018
   tobq2 |   9.397844   1.228769      7.648   0.000       6.989501    11.80619
  cbeta2 |  -1.317951   1.276883     -1.032   0.302      -3.820595    1.184693
   _cons |   -1.12103   1.692904     -0.662   0.508      -4.439061    2.197001
---------+--------------------------------------------------------------------
roe3     |
    lev3 |  -3.656251   1.010161     -3.619   0.000      -5.636129   -1.676372
   tobq3 |    5.39683    1.71286      3.151   0.002       2.039686    8.753974
  cbeta3 |  -2.337329   2.570383     -0.909   0.363      -7.375186    2.700529
   _cons |   4.583473   2.317511      1.978   0.048       .0412343    9.125711
---------+--------------------------------------------------------------------
roe4     |
    lev4 |  -7.865786   1.319979     -5.959   0.000       -10.4529   -5.278674
   tobq4 |    3.27522   1.264505      2.590   0.010       .7968359    5.753603
  cbeta4 |  -8.865709   2.998331     -2.957   0.003      -14.74233   -2.989088
   _cons |    13.3735   2.994658      4.466   0.000       7.504079    19.24292
---------+--------------------------------------------------------------------
roe5     |
    lev5 |  -5.892689   1.319071     -4.467   0.000       -8.47802   -3.307358
   tobq5 |    2.44463   1.252377      1.952   0.051      -.0099843    4.899245
  cbeta5 |  -4.739855   3.023226     -1.568   0.117      -10.66527    1.185558
   _cons |   9.209854    2.91005      3.165   0.002       3.506261    14.91345
---------+--------------------------------------------------------------------
roe6     |
    lev6 |  -4.154991   .7769042     -5.348   0.000      -5.677696   -2.632287
   tobq6 |   12.25611   1.232074      9.948   0.000       9.841285    14.67093
  cbeta6 |  -6.218179   2.122947     -2.929   0.003      -10.37908   -2.057279
   _cons |  -.5543249   2.186064     -0.254   0.800      -4.838932    3.730282
------------------------------------------------------------------------------

. constraint define 1 [roe0]tobq0=[roe1]tobq1

. constraint define 2 [roe0]tobq0=[roe2]tobq2

. constraint define 3 [roe0]tobq0=[roe3]tobq3

. constraint define 4 [roe0]tobq0=[roe4]tobq4

. constraint define 5 [roe0]tobq0=[roe5]tobq5

. constraint define 6 [roe0]tobq0=[roe6]tobq6

. reg3 roe0 roe1 roe2 roe3 roe4 roe5 roe6, constr(1-6)

Three-stage regression results
------------------------------------------------------------------
Equation      Obs  Parms        RMSE    "R-sq"       Chi2        P
------------------------------------------------------------------
 roe0          50      3    5.378119    0.5225     137.65   0.0000
 roe1          50      3     4.25828    0.4122     112.14   0.0000
 roe2          50      3    4.129461    0.4430     104.88   0.0000
 roe3          50      3    4.943927    0.3166     115.45   0.0000
 roe4          50      3    5.202901    0.2780     145.29   0.0000
 roe5          50      3    5.806511    0.0577     126.31   0.0000
 roe6          50      3    3.987614    0.7114     204.44   0.0000
------------------------------------------------------------------
------------------------------------------------------------------------------
         |      Coef.   Std. Err.       z     P>|z|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
roe0     |
    lev0 |  -6.412792   1.449385     -4.424   0.000      -9.253535    -3.57205
   tobq0 |   7.471666   .7462595     10.012   0.000       6.009024    8.934308
  cbeta0 |  -8.004176   3.122194     -2.564   0.010      -14.12357   -1.884788
   _cons |   6.183976   3.267973      1.892   0.058      -.2211334    12.58909
---------+--------------------------------------------------------------------
roe1     |
    lev1 |  -1.339709   .7946672     -1.686   0.092      -2.897228    .2178104
   tobq1 |   7.471666   .7462595     10.012   0.000       6.009024    8.934308
  cbeta1 |  -.0399838   1.664141     -0.024   0.981      -3.301641    3.221673
   _cons |  -.6059587   2.002758     -0.303   0.762      -4.531292    3.319375
---------+--------------------------------------------------------------------
roe2     |
    lev2 |  -.3827113   .3205957     -1.194   0.233      -1.011067    .2456446
   tobq2 |   7.471666   .7462595     10.012   0.000       6.009024    8.934308
  cbeta2 |   -.712405   1.235687     -0.577   0.564      -3.134307    1.709497
   _cons |  -.0047998   1.583208     -0.003   0.998      -3.107831    3.098231
---------+--------------------------------------------------------------------
roe3     |
    lev3 |  -3.477603   .9914421     -3.508   0.000      -5.420794   -1.534412
   tobq3 |   7.471666   .7462595     10.012   0.000       6.009024    8.934308
  cbeta3 |  -5.778826   1.908888     -3.027   0.002      -9.520178   -2.037474
   _cons |   5.998685   2.289109      2.621   0.009       1.512113    10.48526
---------+--------------------------------------------------------------------
roe4     |
    lev4 |  -7.373291   1.310768     -5.625   0.000      -9.942348   -4.804233
   tobq4 |   7.471666   .7462595     10.012   0.000       6.009024    8.934308
  cbeta4 |  -14.91344   2.641978     -5.645   0.000      -20.09163   -9.735262
   _cons |   15.25908   2.949599      5.173   0.000       9.477977    21.04019
---------+--------------------------------------------------------------------
roe5     |
    lev5 |  -5.198221   1.296377     -4.010   0.000      -7.739073    -2.65737
   tobq5 |   7.471666   .7462595     10.012   0.000       6.009024    8.934308
  cbeta5 |  -12.46723   2.750981     -4.532   0.000      -17.85905   -7.075405
   _cons |   11.71601   2.892809      4.050   0.000       6.046206    17.38581
---------+--------------------------------------------------------------------
roe6     |
    lev6 |  -5.632286   .7275719     -7.741   0.000      -7.058301   -4.206271
   tobq6 |   7.471666   .7462595     10.012   0.000       6.009024    8.934308
  cbeta6 |  -3.131417   2.020763     -1.550   0.121       -7.09204    .8292065
   _cons |   1.686523   2.136525      0.789   0.430      -2.500988    5.874035
------------------------------------------------------------------------------

. log close

Example of fixed and random effects estimation and testing


. use 761panel

. iis cusip

. tis yearptr

. summ

Variable |     Obs        Mean   Std. Dev.       Min        Max
---------+-----------------------------------------------------
   cbeta |     350    1.012257   .2642095        .29       2.27  
   cusip |     350      469349   276041.5       1688     963320  
     roe |     350    4.637486   6.522068   -20.0409    23.9925  
    caar |     350    48.55116   12.19374      6.119     75.663  
    clar |     350    22.72243   8.557115     7.7771    52.4518  
    tobq |     350    .9794063   .4945858      .4097     4.0775  
     lev |     350      .48799   .7155065      .0026      9.605  
 yearptr |     350           3   2.002863          0          6  
  firmnr |     350        25.5   14.45153          1         50  

. regress roe lev tobq cbeta

  Source |       SS       df       MS                  Number of obs =     350
---------+------------------------------               F(  3,   346) =   60.10
   Model |  5085.68891     3  1695.22964               Prob > F      =  0.0000
Residual |  9759.85575   346  28.2076756               R-squared     =  0.3426
---------+------------------------------               Adj R-squared =  0.3369
   Total |  14845.5447   349  42.5373773               Root MSE      =  5.3111

------------------------------------------------------------------------------
     roe |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
     lev |  -3.311485   .4175035     -7.932   0.000       -4.13265   -2.490321
    tobq |   6.249819   .6699128      9.329   0.000       4.932205    7.567433
   cbeta |  -6.027554   1.258113     -4.791   0.000      -8.502067   -3.553042
   _cons |   6.233781   1.239266      5.030   0.000       3.796339    8.671223
------------------------------------------------------------------------------

. xtreg roe lev tobq cbeta,fe

                                             Fixed-effects (within) regression
sd(u_cusip)                  =  3.999577               Number of obs =     350
sd(e_cusip_t)                =  4.303878                           n =      50
sd(e_cusip_t + u_cusip)      =  5.875371                           T =       7

corr(u_cusip, Xb)            =    0.3382               R-sq within   =  0.0682
                                                            between  =  0.4774
                                                            overall  =  0.3021

                                                       F(  3,   297) =    7.24
                                                            Prob > F =  0.0001

------------------------------------------------------------------------------
     roe |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
     lev |  -1.128466    .504682     -2.236   0.026      -2.121672   -.1352598
    tobq |   4.195395   1.151747      3.643   0.000       1.928775    6.462015
   cbeta |  -1.410826   1.861015     -0.758   0.449      -5.073272    2.251621
   _cons |   2.507288   2.285862      1.097   0.274       -1.99125    7.005826
------------------------------------------------------------------------------
   cusip |           F(49,297) =      4.692   0.000           (50 categories)

. gen t1=(yearptr==1)

. gen t2=(yearptr==2)

. gen t3=(yearptr==3)

. gen t4=(yearptr==4)

. gen t5=(yearptr==5)

. gen t6=(yearptr==6)

. xtreg roe lev tobq cbeta t1 t2 t3 t4 t5 t6,fe

                                             Fixed-effects (within) regression
sd(u_cusip)                  =  3.888367               Number of obs =     350
sd(e_cusip_t)                =  4.087506                           n =      50
sd(e_cusip_t + u_cusip)      =  5.641552                           T =       7

corr(u_cusip, Xb)            =    0.3630               R-sq within   =  0.1765
                                                            between  =  0.5601
                                                            overall  =  0.3692

                                                       F(  9,   291) =    6.93
                                                            Prob > F =  0.0000

------------------------------------------------------------------------------
     roe |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
     lev |  -1.422335   .4843476     -2.937   0.004      -2.375604   -.4690668
    tobq |   4.302949   1.119553      3.843   0.000       2.099501    6.506398
   cbeta |  -3.302664   1.809873     -1.825   0.069      -6.864764    .2594367
      t1 |   2.901427   .8245561      3.519   0.001       1.278578    4.524277
      t2 |     3.3231   .8413604      3.950   0.000       1.667177    4.979023
      t3 |   2.404432   .8310946      2.893   0.004       .7687135     4.04015
      t4 |    .552143   .8279086      0.667   0.505      -1.077305    2.181591
      t5 |   .9508953   .8271815      1.150   0.251      -.6771214    2.578912
      t6 |  -.4629081   .8378573     -0.552   0.581      -2.111937     1.18612
   _cons |   3.079083   2.330518      1.321   0.187      -1.507725     7.66589
------------------------------------------------------------------------------
   cusip |           F(49,291) =      4.939   0.000           (50 categories)

. test t1 t2 t3 t4 t5 t6

 ( 1)  t1 = 0.0
 ( 2)  t2 = 0.0
 ( 3)  t3 = 0.0
 ( 4)  t4 = 0.0
 ( 5)  t5 = 0.0
 ( 6)  t6 = 0.0

       F(  6,   291) =    6.38
            Prob > F =    0.0000


. xtreg roe lev tobq cbeta,be

                                                      Between-CUSIP regression
                                                       Number of obs =     350
                                                                   n =      50
                                                                   T =       7

                                                       R-sq within   =  0.0552
                                                            between  =  0.6479
                                                            overall  =  0.3296

sd(u_cusip + e_cusip) = 3.127082                       F(  3,    46) =   28.21
   where     e_cusip  = avg(e_cusip_t)                      Prob > F =  0.0000

------------------------------------------------------------------------------
     roe |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
     lev |  -5.417003   .8862412     -6.112   0.000      -7.200914   -3.633092
    tobq |   7.606025   1.266062      6.008   0.000       5.057575    10.15448
   cbeta |  -10.96147   2.528266     -4.336   0.000      -16.05061   -5.872337
   _cons |   10.92737    2.34867      4.653   0.000       6.199742      15.655
------------------------------------------------------------------------------

. xtreg roe lev tobq cbeta t1 t2 t3 t4 t5 t6,re

                                                 Random-effects GLS regression
sd(u_cusip)                  =  2.718791               Number of obs =     350
sd(e_cusip_t)                =  4.087506                           n =      50
sd(e_cusip_t + u_cusip)      =  4.909128                           T =       7

corr(u_cusip, X)             =  0 (assumed)            R-sq within   =  0.1708
                                                            between  =  0.5834
                                                            overall  =  0.3899

                                                       chi2(  9)     =  118.22
(theta = 0.5060)                                         Prob > chi2 =  0.0000

------------------------------------------------------------------------------
     roe |      Coef.   Std. Err.       z     P>|z|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
     lev |  -2.275645   .4350806     -5.230   0.000      -3.128388   -1.422903
    tobq |   5.522897   .8010853      6.894   0.000       3.952798    7.092995
   cbeta |   -4.34108   1.417614     -3.062   0.002      -7.119553   -1.562608
      t1 |   3.137502   .8454078      3.711   0.000       1.480533     4.79447
      t2 |   3.748877   .8584717      4.367   0.000       2.066303    5.431451
      t3 |   2.683392   .8477208      3.165   0.002        1.02189    4.344894
      t4 |   .8020803   .8466725      0.947   0.343      -.8573672    2.461528
      t5 |   1.138707   .8444958      1.348   0.178      -.5164742    2.793889
      t6 |  -.1861015   .8486201     -0.219   0.826      -1.849366    1.477163
   _cons |   3.115329   1.645929      1.893   0.058      -.1106337    6.341291
------------------------------------------------------------------------------

. xttest0

Breusch and Pagan Lagrangian multiplier test for random effects:

        roe[cusip,t] = Xb + u[cusip] + e[cusip,t]

        Estimated results:
                                 Var     sd = sqrt(Var)
                ---------+-----------------------------
                     roe |   42.53738       6.522068
                       e |   16.70771      4.0875064
                       u |   7.391826      2.7187913

        Test:   Var(u) = 0
                              chi2(1) =    94.79
                            Prob>chi2 =     0.0000

. xthaus

Hausman specification test

            ---- Coefficients ----
         |      Fixed       Random
     roe |    Effects      Effects       Difference
---------+-----------------------------------------
     lev |  -1.422335    -2.275645           .85331
    tobq |   4.302949     5.522897        -1.219948
   cbeta |  -3.302664     -4.34108         1.038416
      t1 |   2.901427     3.137502        -.2360742
      t2 |     3.3231     3.748877        -.4257769
      t3 |   2.404432     2.683392        -.2789602
      t4 |    .552143     .8020803        -.2499373
      t5 |   .9508953     1.138707         -.187812
      t6 |  -.4629081    -.1861015        -.2768067

Test:  Ho:  difference in coefficients not systematic

             chi2(  9) = (b-B)'[S^(-1)](b-B), S = (S_fe - S_re)
                       =    27.73
             Prob>chi2 =     0.0011

. xtreg roe lev tobq cbeta t1 t2 t3 t4 t5 t6,gee robust

Iteration 1: tolerance = .31924473
Iteration 2: tolerance = .05454121
Iteration 3: tolerance = .0068676
Iteration 4: tolerance = .00084529
Iteration 5: tolerance = .00010386
Iteration 6: tolerance = .00001276
Iteration 7: tolerance = 1.567e-06
Iteration 8: tolerance = 1.926e-07

General estimating equation for panel data        Number of obs    =       350
Group variable:                      cusip        Number of groups =        50
Link:                             identity        Obs/group, min   =         7
Family:                           Gaussian                   avg   =      7.00
Correlation:                  exchangeable                   max   =         7
                                                  chi2(9)          =     47.24
Scale parameter:                  27.55153        Prob > chi2      =    0.0000
Pearson chi2(340):                 9367.52        Deviance         =   9367.52
Dispersion (Pearson):             27.55153        Dispersion       =  27.55153

                            (standard errors adjusted for clustering on cusip)
------------------------------------------------------------------------------
         |               Robust
     roe |      Coef.   Std. Err.       z     P>|z|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
     lev |  -2.103859   1.093423     -1.924   0.054      -4.246927    .0392101
    tobq |   5.350733   2.129325      2.513   0.012       1.177332    9.524134
   cbeta |  -4.035968   1.293775     -3.120   0.002      -6.571719   -1.500216
      t1 |   3.092823   .8840228      3.499   0.000        1.36017    4.825476
      t2 |   3.666879    .886862      4.135   0.000       1.928661    5.405096
      t3 |   2.636005   .9979949      2.641   0.008       .6799707    4.592039
      t4 |   .7580542   1.103556      0.687   0.492      -1.404875    2.920984
      t5 |   1.109996   1.052563      1.055   0.292      -.9529891    3.172981
      t6 |  -.2279562   .7144659     -0.319   0.750      -1.628284    1.172371
   _cons |   2.932501   3.082205      0.951   0.341      -3.108511    8.973512
------------------------------------------------------------------------------

. log close


Example of general estimating equation approach

. xtreg roe lev tobq cbeta,gee robust

Iteration 1: tolerance = .40395989
Iteration 2: tolerance = .10012121
Iteration 3: tolerance = .01515
Iteration 4: tolerance = .00208385
Iteration 5: tolerance = .00028282
Iteration 6: tolerance = .00003832
Iteration 7: tolerance = 5.189e-06
Iteration 8: tolerance = 7.028e-07

General estimating equation for panel data        Number of obs    =       350
Group variable:                      cusip        Number of groups =        50
Link:                             identity        Obs/group, min   =         7
Family:                           Gaussian                   avg   =      7.00
Correlation:                  exchangeable                   max   =         7
                                                  chi2(3)          =     10.20
Scale parameter:                   29.7064        Prob > chi2      =    0.0169
Pearson chi2(346):                10278.41        Deviance         =  10278.41
Dispersion (Pearson):              29.7064        Dispersion       =   29.7064

                            (standard errors adjusted for clustering on cusip)
------------------------------------------------------------------------------
         |               Robust
     roe |      Coef.   Std. Err.       z     P>|z|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
     lev |  -1.859506   1.204687     -1.544   0.123      -4.220649    .5016363
    tobq |   5.110386   2.283293      2.238   0.025       .6352144    9.585558
   cbeta |  -2.703274    1.41072     -1.916   0.055      -5.468235    .0616876
   _cons |   3.276171   2.804858      1.168   0.243       -2.22125    8.773591
------------------------------------------------------------------------------

. xtcorr

Estimated within-cusip correlation matrix R:

        c1      c2      c3      c4      c5      c6      c7
r1  1.0000
r2  0.3679  1.0000
r3  0.3679  0.3679  1.0000
r4  0.3679  0.3679  0.3679  1.0000
r5  0.3679  0.3679  0.3679  0.3679  1.0000
r6  0.3679  0.3679  0.3679  0.3679  0.3679  1.0000
r7  0.3679  0.3679  0.3679  0.3679  0.3679  0.3679  1.0000



. xtgee roe lev tobq cbeta,i(cusip) robust corr(ar 1)

Iteration 1: tolerance = .47461104
Iteration 2: tolerance = .18630244
Iteration 3: tolerance = .04941979
Iteration 4: tolerance = .01135421
Iteration 5: tolerance = .00251905
Iteration 6: tolerance = .00055452
Iteration 7: tolerance = .00012186
Iteration 8: tolerance = .00002677
Iteration 9: tolerance = 5.880e-06
Iteration 10: tolerance = 1.291e-06
Iteration 11: tolerance = 2.837e-07

General estimating equation for panel data        Number of obs    =       350
Group and time vars:         cusip yearptr        Number of groups =        50
Link:                             identity        Obs/group, min   =         7
Family:                           Gaussian                   avg   =      7.00
Correlation:                         AR(1)                   max   =         7
                                                  chi2(3)          =     11.75
Scale parameter:                  30.26509        Prob > chi2      =    0.0083
Pearson chi2(346):                10471.72        Deviance         =  10471.72
Dispersion (Pearson):             30.26509        Dispersion       =  30.26509

                            (standard errors adjusted for clustering on cusip)
------------------------------------------------------------------------------
         |               Robust
     roe |      Coef.   Std. Err.       z     P>|z|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
     lev |  -1.491783   1.143138     -1.305   0.192      -3.732291    .7487259
    tobq |   5.841872    2.11482      2.762   0.006       1.696902    9.986842
   cbeta |   -2.64202   1.261292     -2.095   0.036      -5.114107   -.1699339
   _cons |   1.896908   2.543048      0.746   0.456      -3.087375    6.881191
------------------------------------------------------------------------------

. xtcorr

Estimated within-cusip correlation matrix R:

        c1      c2      c3      c4      c5      c6      c7
r1  1.0000
r2  0.5479  1.0000
r3  0.3002  0.5479  1.0000
r4  0.1644  0.3002  0.5479  1.0000
r5  0.0901  0.1644  0.3002  0.5479  1.0000
r6  0.0494  0.0901  0.1644  0.3002  0.5479  1.0000
r7  0.0270  0.0494  0.0901  0.1644  0.3002  0.5479  1.0000




. xtgee roe lev tobq cbeta,i(cusip) robust corr(unstr)

Iteration 1: tolerance = .51175757
Iteration 2: tolerance = 2.6738424
Iteration 3: tolerance = 2.3017692
Iteration 4: tolerance = 1.2167117
Iteration 5: tolerance = .35387164
Iteration 6: tolerance = .08978389
Iteration 7: tolerance = .02667489
Iteration 8: tolerance = .0081013
Iteration 9: tolerance = .00243384
Iteration 10: tolerance = .00086395
Iteration 11: tolerance = .0003479
Iteration 12: tolerance = .0001394
Iteration 13: tolerance = .00005563
Iteration 14: tolerance = .00002213
Iteration 15: tolerance = 8.776e-06
Iteration 16: tolerance = 3.473e-06
Iteration 17: tolerance = 1.372e-06
Iteration 18: tolerance = 5.409e-07

General estimating equation for panel data        Number of obs    =       350
Group and time vars:         cusip yearptr        Number of groups =        50
Link:                             identity        Obs/group, min   =         7
Family:                           Gaussian                   avg   =      7.00
Correlation:                  unstructured                   max   =         7
                                                  chi2(3)          =     22.78
Scale parameter:                  29.99862        Prob > chi2      =    0.0000
Pearson chi2(346):                10379.52        Deviance         =  10379.52
Dispersion (Pearson):             29.99862        Dispersion       =  29.99862

                            (standard errors adjusted for clustering on cusip)
------------------------------------------------------------------------------
         |               Robust
     roe |      Coef.   Std. Err.       z     P>|z|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
     lev |  -1.418994      .9445     -1.502   0.133       -3.27018    .4321921
    tobq |   6.714472    1.95538      3.434   0.001       2.881998    10.54695
   cbeta |  -3.824281   1.236249     -3.093   0.002      -6.247284   -1.401277
   _cons |   2.705321   2.594746      1.043   0.297      -2.380288    7.790929
------------------------------------------------------------------------------

. xtcorr

Estimated within-cusip correlation matrix R:

        c1      c2      c3      c4      c5      c6      c7
r1  1.0000
r2  0.2275  1.0000
r3  0.1898  0.5095  1.0000
r4  0.3641  0.4431  0.5111  1.0000
r5  0.3797  0.1068  0.1189  0.5607  1.0000
r6  0.5273  0.1861  0.1945  0.5300  0.9750  1.0000
r7  0.6698  0.0541  0.0662  0.2299  0.4149  0.4271  1.0000