UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

Stata Textbook Examples
Econometric Analysis of Cross Section and Panel Data by Jeffrey M. Wooldridge
Chapter 7: Estimating Systems of Equations by OLS and GLS

Example 7.3 on page 165 using fringe.dta.
use http://www.stata.com/data/jwooldridge/eacsap/fringe

sureg ( hrearn educ exper expersq tenure  tenuresq union south nrtheast nrthcen married white male) ( hrbens educ exper expersq tenure tenuresq union south nrtheast nrthcen married white male)

Seemingly unrelated regression
----------------------------------------------------------------------
Equation          Obs  Parms        RMSE    "R-sq"       chi2        P
----------------------------------------------------------------------
hrearn            616     12      4.3089    0.2051     158.93   0.0000
hrbens            616     12    .5152603    0.3987     408.40   0.0000
----------------------------------------------------------------------

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
hrearn       |
        educ |   .4588139    .068393     6.71   0.000     .3247662    .5928617
       exper |  -.0758428   .0567371    -1.34   0.181    -.1870455    .0353598
     expersq |   .0039945   .0011655     3.43   0.001     .0017102    .0062787
      tenure |   .1100846   .0829207     1.33   0.184     -.052437    .2726062
    tenuresq |  -.0050706   .0032422    -1.56   0.118    -.0114252    .0012839
       union |   .8079933   .4034789     2.00   0.045     .0171892    1.598797
       south |  -.4566222   .5458508    -0.84   0.403     -1.52647    .6132258
    nrtheast |  -1.150759   .5993283    -1.92   0.055     -2.32542    .0239032
     nrthcen |  -.6362663   .5501462    -1.16   0.247    -1.714533    .4420005
     married |   .6423882   .4133664     1.55   0.120     -.167795    1.452571
       white |   1.140891   .6054474     1.88   0.060    -.0457639    2.327546
        male |   1.784702   .3937853     4.53   0.000     1.012897    2.556507
       _cons |  -2.632127   1.215291    -2.17   0.030    -5.014054   -.2501997
-------------+----------------------------------------------------------------
hrbens       |
        educ |   .0767924   .0081785     9.39   0.000     .0607629    .0928219
       exper |   .0225649   .0067846     3.33   0.001     .0092673    .0358626
     expersq |  -.0004734   .0001394    -3.40   0.001    -.0007465   -.0002002
      tenure |   .0535556   .0099157     5.40   0.000     .0341212      .07299
    tenuresq |  -.0011636   .0003877    -3.00   0.003    -.0019235   -.0004038
       union |   .3659085   .0482482     7.58   0.000     .2713438    .4604733
       south |  -.0226865   .0652731    -0.35   0.728    -.1506195    .1052464
    nrtheast |  -.0567468    .071668    -0.79   0.428    -.1972135    .0837198
     nrthcen |  -.0379984   .0657867    -0.58   0.564    -.1669381    .0909413
     married |   .0578626   .0494306     1.17   0.242    -.0390195    .1547447
       white |   .0901582   .0723997     1.25   0.213    -.0517426     .232059
        male |   .2683383    .047089     5.70   0.000     .1760454    .3606311
       _cons |  -.8897471   .1453251    -6.12   0.000    -1.174579   -.6049151
------------------------------------------------------------------------------
Example 7.7 on page 172 using jtrain1.dta.
use http://www.stata.com/data/jwooldridge/eacsap/jtrain1, clear

reg lscrap d89 d88 grant grant_1

      Source |       SS       df       MS              Number of obs =     162
-------------+------------------------------           F(  4,   157) =    0.69
       Model |  6.15830732     4  1.53957683           Prob > F      =  0.5989
    Residual |  349.586781   157   2.2266674           R-squared     =  0.0173
-------------+------------------------------           Adj R-squared = -0.0077
       Total |  355.745089   161  2.20959682           Root MSE      =  1.4922

------------------------------------------------------------------------------
      lscrap |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         d89 |  -.4965236   .3379281    -1.47   0.144    -1.163996    .1709483
         d88 |  -.2393704   .3108639    -0.77   0.442    -.8533854    .3746446
       grant |   .2000197   .3382846     0.59   0.555    -.4681564    .8681958
     grant_1 |   .0489357   .4360663     0.11   0.911    -.8123778    .9102492
       _cons |   .5974341    .203063     2.94   0.004     .1963462    .9985219
------------------------------------------------------------------------------

xtgls lscrap d89 d88 grant grant_1, i(fcode)

Cross-sectional time-series FGLS regression
Coefficients:  generalized least squares
Panels:        homoskedastic
Correlation:   no autocorrelation
Estimated covariances      =         1          Number of obs      =       162
Estimated autocorrelations =         0          Number of groups   =        54
Estimated coefficients     =         5          Time periods       =         3
                                                Wald chi2(4)       =      2.85
Log likelihood             = -292.1696          Prob > chi2        =    0.5826
------------------------------------------------------------------------------
      lscrap |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         d89 |  -.4965236   .3326723    -1.49   0.136    -1.148549    .1555021
         d88 |  -.2393704    .306029    -0.78   0.434    -.8391763    .3604354
       grant |   .2000197   .3330233     0.60   0.548    -.4526939    .8527332
     grant_1 |   .0489357   .4292842     0.11   0.909    -.7924458    .8903172
       _cons |   .5974341   .1999048     2.99   0.003     .2056279    .9892402
------------------------------------------------------------------------------
Example 7.8 on page 173 and example 7.9 on page 177 using gpa.dta.
use http://www.stata.com/data/jwooldridge/eacsap/gpa, clear

reg  trmgpa spring cumgpa crsgpa frstsem season sat verbmath hsperc hssize black female

      Source |       SS       df       MS              Number of obs =     732
-------------+------------------------------           F( 11,   720) =   70.64
       Model |  218.156689    11  19.8324263           Prob > F      =  0.0000
    Residual |  202.140267   720  .280750371           R-squared     =  0.5191
-------------+------------------------------           Adj R-squared =  0.5117
       Total |  420.296956   731  .574961636           Root MSE      =  .52986
------------------------------------------------------------------------------
      trmgpa |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      spring |  -.0121568   .0464813    -0.26   0.794    -.1034118    .0790983
      cumgpa |   .3146158   .0404916     7.77   0.000     .2351201    .3941115
      crsgpa |   .9840371   .0960343    10.25   0.000     .7954964    1.172578
     frstsem |   .7691192   .1204162     6.39   0.000     .5327104    1.005528
      season |  -.0462625   .0470985    -0.98   0.326    -.1387292    .0462042
         sat |   .0014097   .0001464     9.63   0.000     .0011223    .0016972
    verbmath |   -.112616   .1306157    -0.86   0.389    -.3690491    .1438171
      hsperc |  -.0066014   .0010195    -6.48   0.000    -.0086029   -.0045998
      hssize |  -.0000576   .0000994    -0.58   0.562    -.0002527    .0001375
       black |  -.2312855   .0543347    -4.26   0.000    -.3379589   -.1246122
      female |   .2855528   .0509641     5.60   0.000     .1854967    .3856089
       _cons |  -2.067599   .3381007    -6.12   0.000    -2.731381   -1.403818
------------------------------------------------------------------------------

xtgls  trmgpa spring cumgpa crsgpa frstsem season sat verbmath hsperc hssize black female, i(id)

Cross-sectional time-series FGLS regression

Coefficients:  generalized least squares
Panels:        homoskedastic
Correlation:   no autocorrelation

Estimated covariances      =         1          Number of obs      =       732
Estimated autocorrelations =         0          Number of groups   =       366
Estimated coefficients     =        12          Time periods       =         2
                                                Wald chi2(11)      =    790.00
Log likelihood             = -567.6874          Prob > chi2        =    0.0000

------------------------------------------------------------------------------
      trmgpa |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      spring |  -.0121568   .0460987    -0.26   0.792    -.1025086     .078195
      cumgpa |   .3146158   .0401583     7.83   0.000     .2359069    .3933247
      crsgpa |   .9840371   .0952439    10.33   0.000     .7973625    1.170712
     frstsem |   .7691192   .1194251     6.44   0.000     .5350503    1.003188
      season |  -.0462625   .0467108    -0.99   0.322     -.137814     .045289
         sat |   .0014097   .0001452     9.71   0.000     .0011251    .0016943
    verbmath |   -.112616   .1295406    -0.87   0.385     -.366511    .1412789
      hsperc |  -.0066014   .0010111    -6.53   0.000    -.0085831   -.0046196
      hssize |  -.0000576   .0000986    -0.58   0.559    -.0002508    .0001356
       black |  -.2312855   .0538875    -4.29   0.000     -.336903    -.125668
      female |   .2855528   .0505447     5.65   0.000      .186487    .3846185
       _cons |  -2.067599   .3353179    -6.17   0.000    -2.724811   -1.410388
------------------------------------------------------------------------------

predict res, res
sort id term
by id: gen res1 = res[_n-1]
(366 missing values generated)

reg  trmgpa cumgpa crsgpa season sat verbmath hsperc hssize black female res1
      Source |       SS       df       MS              Number of obs =     366
-------------+------------------------------           F( 10,   355) =   56.83
       Model |  133.915693    10  13.3915693           Prob > F      =  0.0000
    Residual |  83.6475687   355  .235626954           R-squared     =  0.6155
-------------+------------------------------           Adj R-squared =  0.6047
       Total |  217.563261   365   .59606373           Root MSE      =  .48541
------------------------------------------------------------------------------
      trmgpa |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      cumgpa |   .3488556   .0720263     4.84   0.000     .2072037    .4905075
      crsgpa |    1.00062    .117679     8.50   0.000     .7691844    1.232056
      season |  -.0271035   .0579515    -0.47   0.640     -.141075     .086868
         sat |   .0014126   .0001991     7.09   0.000      .001021    .0018042
    verbmath |  -.1136652   .1702718    -0.67   0.505    -.4485335    .2212032
      hsperc |  -.0049537   .0014175    -3.49   0.001    -.0077415    -.002166
      hssize |  -.0000843   .0001289    -0.65   0.513    -.0003378    .0001691
       black |  -.2407423   .0706801    -3.41   0.001    -.3797466    -.101738
      female |    .291915   .0732572     3.98   0.000     .1478423    .4359876
        res1 |   .1941929   .0612068     3.17   0.002     .0738194    .3145664
       _cons |  -2.266297   .4246611    -5.34   0.000    -3.101465   -1.431129
------------------------------------------------------------------------------

How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California