Stata Textbook Examples
Introductory Econometrics: A Modern Approach by Jeffrey M. Wooldridge (1st & 2d eds.)
Chapter 4 - Multiple Regression Analysis: Inference

Example 4.1: Hourly Wage Equation

use http://fmwww.bc.edu/ec-p/data/wooldridge/wage1 
reg lwage educ exper tenure

  Source |       SS       df       MS                  Number of obs =     526
---------+------------------------------               F(  3,   522) =   80.39
   Model |  46.8741805     3  15.6247268               Prob > F      =  0.0000
Residual |  101.455581   522  .194359351               R-squared     =  0.3160
---------+------------------------------               Adj R-squared =  0.3121
   Total |  148.329762   525   .28253288               Root MSE      =  .44086

------------------------------------------------------------------------------
   lwage |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
    educ |    .092029   .0073299     12.555   0.000       .0776292    .1064288
   exper |   .0041211   .0017233      2.391   0.017       .0007357    .0075065
  tenure |   .0220672   .0030936      7.133   0.000       .0159897    .0281448
   _cons |   .2843595   .1041904      2.729   0.007       .0796755    .4890435
------------------------------------------------------------------------------

Inclease in log(wage) if experience increases by 3 years

display _b[exper]*3
.0123

Example 4.2: Student Performance and School Size

use http://fmwww.bc.edu/ec-p/data/wooldridge/meap93 
reg math10 totcomp staff enroll

  Source |       SS       df       MS                  Number of obs =     408
---------+------------------------------               F(  3,   404) =    7.70
   Model |  2422.93434     3  807.644779               Prob > F      =  0.0001
Residual |  42394.2462   404  104.936253               R-squared     =  0.0541
---------+------------------------------               Adj R-squared =  0.0470
   Total |  44817.1805   407  110.115923               Root MSE      =  10.244

------------------------------------------------------------------------------
  math10 |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
 totcomp |   .0004586   .0001004      4.570   0.000       .0002613    .0006559
   staff |   .0479199    .039814      1.204   0.229      -.0303487    .1261884
  enroll |  -.0001976   .0002152     -0.918   0.359      -.0006207    .0002255
   _cons |   2.274021   6.113794      0.372   0.710        -9.7448    14.29284
------------------------------------------------------------------------------
reg math10 ltotcomp lstaff lenroll

  Source |       SS       df       MS                  Number of obs =     408
---------+------------------------------               F(  3,   404) =    9.42
   Model |  2930.03231     3  976.677437               Prob > F      =  0.0000
Residual |  41887.1482   404   103.68106               R-squared     =  0.0654
---------+------------------------------               Adj R-squared =  0.0584
   Total |  44817.1805   407  110.115923               Root MSE      =  10.182

------------------------------------------------------------------------------
  math10 |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
ltotcomp |   21.15498   4.055549      5.216   0.000       13.18237     29.1276
  lstaff |   3.979981   4.189659      0.950   0.343      -4.256274    12.21624
 lenroll |  -1.268042   .6932037     -1.829   0.068      -2.630778     .094695
   _cons |  -207.6645   48.70311     -4.264   0.000      -303.4077   -111.9213
------------------------------------------------------------------------------

Change in math10 if enrollment increases by 1 percent

display _b[lenrol]/100
-.013

Example 4.3: Determinants of College GPA

use http://fmwww.bc.edu/ec-p/data/wooldridge/gpa1
reg colGPA hsGPA ACT skipped

  Source |       SS       df       MS                  Number of obs =     141
---------+------------------------------               F(  3,   137) =   13.92
   Model |  4.53313314     3  1.51104438               Prob > F      =  0.0000
Residual |  14.8729663   137  .108561798               R-squared     =  0.2336
---------+------------------------------               Adj R-squared =  0.2168
   Total |  19.4060994   140  .138614996               Root MSE      =  .32949

------------------------------------------------------------------------------
  colGPA |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
   hsGPA |   .4118162   .0936742      4.396   0.000       .2265819    .5970505
     ACT |   .0147202   .0105649      1.393   0.166      -.0061711    .0356115
 skipped |  -.0831131   .0259985     -3.197   0.002      -.1345234   -.0317028
   _cons |   1.389554   .3315535      4.191   0.000       .7339295    2.045178
------------------------------------------------------------------------------

Example 4.4: Campus Crime and Enrollment

use http://fmwww.bc.edu/ec-p/data/wooldridge/campus
reg lcrime lenroll 

      Source |       SS       df       MS              Number of obs =      97
-------------+------------------------------           F(  1,    95) =  133.79
       Model |  107.083654     1  107.083654           Prob > F      =  0.0000
    Residual |  76.0358244    95  .800377098           R-squared     =  0.5848
-------------+------------------------------           Adj R-squared =  0.5804
       Total |  183.119479    96  1.90749457           Root MSE      =  .89464

------------------------------------------------------------------------------
      lcrime |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     lenroll |    1.26976    .109776    11.57   0.000     1.051827    1.487693
       _cons |   -6.63137    1.03354    -6.42   0.000    -8.683206   -4.579533
------------------------------------------------------------------------------

T-statistics for testing the coefficient on lenrol equal to 1

scalar tvalue=(_b[lenrol]-1)/_se[lenrol]
scalar pvalue=ttail(120,tvalue)
display "T-value: " tvalue ", P=value: " pvalue

T-statistics: 2.45737, P=value: .00771259
test lenroll=1 

 ( 1)  lenroll = 1.0

       F(  1,    95) =    6.04
            Prob > F =    0.0158 

Example 4.5: Housing Prices and Air Pollution

use http://fmwww.bc.edu/ec-p/data/wooldridge/hprice2
gen ldist=log(dist)
reg lprice lnox ldist rooms stratio

  Source |       SS       df       MS                  Number of obs =     506
---------+------------------------------               F(  4,   501) =  175.86
   Model |  49.3987735     4  12.3496934               Prob > F      =  0.0000
Residual |  35.1834974   501  .070226542               R-squared     =  0.5840
---------+------------------------------               Adj R-squared =  0.5807
   Total |  84.5822709   505  .167489645               Root MSE      =    .265

------------------------------------------------------------------------------
  lprice |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
    lnox |    -.95354   .1167418     -8.168   0.000      -1.182904   -.7241762
   ldist |  -.1343401   .0431032     -3.117   0.002      -.2190255   -.0496548
   rooms |   .2545271   .0185303     13.736   0.000       .2181203    .2909338
 stratio |  -.0524512   .0058971     -8.894   0.000      -.0640373   -.0408651
   _cons |   11.08387   .3181115     34.843   0.000       10.45887    11.70886
------------------------------------------------------------------------------

Example 4.6: Participation Rates in 401K Plans

use http://fmwww.bc.edu/ec-p/data/wooldridge/401k 
reg prate mrate age totemp

  Source |       SS       df       MS                  Number of obs =    1534
---------+------------------------------               F(  3,  1530) =   56.41
   Model |  42666.5732     3  14222.1911               Prob > F      =  0.0000
Residual |  385718.966  1530  252.103899               R-squared     =  0.0996
---------+------------------------------               Adj R-squared =  0.0978
   Total |  428385.539  1533  279.442622               Root MSE      =  15.878

------------------------------------------------------------------------------
   prate |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
   mrate |   5.441433   .5244086     10.376   0.000       4.412797    6.470068
     age |   .2694073   .0451486      5.967   0.000       .1808477    .3579669
  totemp |  -.0001298   .0000367     -3.535   0.000      -.0002018   -.0000578
   _cons |   80.29429   .7776952    103.246   0.000       78.76882    81.81975
------------------------------------------------------------------------------

Change in participation rate if total employment increases by 10,000

 display _b[totemp]*10000
-1.2978125

Example 4.7: Effect of Job Training Grants on Firm Scrap Rates

use http://fmwww.bc.edu/ec-p/data/wooldridge/jtrain 
summ hrsemp sales employ

Variable |     Obs        Mean   Std. Dev.       Min        Max
---------+-----------------------------------------------------
  hrsemp |     390    14.96754   25.71064          0   163.9167  
   sales |     373     6116327    7912603     110000   5.40e+07  
  employ |     440    59.31591   74.12378          4        525  
reg lscrap hrsemp lsales lemploy

  Source |       SS       df       MS                  Number of obs =     135
---------+------------------------------               F(  3,   131) =    4.66
   Model |  27.3075334     3  9.10251115               Prob > F      =  0.0040
Residual |  256.148694   131  1.95533354               R-squared     =  0.0963
---------+------------------------------               Adj R-squared =  0.0756
   Total |  283.456227   134  2.11534498               Root MSE      =  1.3983

------------------------------------------------------------------------------
  lscrap |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
  hrsemp |  -.0031172   .0045738     -0.682   0.497      -.0121651    .0059308
  lsales |  -.7265661   .2169671     -3.349   0.001      -1.155779   -.2973534
 lemploy |   .7457646   .2090992      3.567   0.001       .3321164    1.159413
   _cons |   8.800996   2.716819      3.239   0.002        3.42648    14.17551
------------------------------------------------------------------------------

Change in Firm Scrap Rates if training per employee increases by 1 hour

display _b[hrsemp]*1
-.00311716

Change in Firm Scrap Rates if training per employee increases by 5 hour

display _b[hrsemp]*5
-.01558579

Note: the textbook example is based on an undocumented subset of this dataset.


Example 4.8: Hedonic Price Model for Houses

Dataset is not available

Example 4.9: Parents Education in a Birth Weight Equation

use http://fmwww.bc.edu/ec-p/data/wooldridge/bwght 
reg bwght cigs parity faminc motheduc fatheduc

  Source |       SS       df       MS                  Number of obs =    1191
---------+------------------------------               F(  5,  1185) =    9.55
   Model |  18705.5567     5  3741.11135               Prob > F      =  0.0000
Residual |  464041.135  1185  391.595895               R-squared     =  0.0387
---------+------------------------------               Adj R-squared =  0.0347
   Total |  482746.692  1190  405.669489               Root MSE      =  19.789

------------------------------------------------------------------------------
   bwght |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
    cigs |  -.5959362   .1103479     -5.401   0.000      -.8124352   -.3794373
  parity |   1.787603   .6594055      2.711   0.007        .493871    3.081336
  faminc |   .0560414   .0365616      1.533   0.126      -.0156913    .1277742
motheduc |  -.3704503   .3198551     -1.158   0.247      -.9979957    .2570951
fatheduc |   .4723944   .2826433      1.671   0.095      -.0821426    1.026931
   _cons |   114.5243   3.728453     30.716   0.000       107.2092    121.8394
------------------------------------------------------------------------------

Test for joint significance of motheduc and fatheduc

test motheduc fatheduc

 ( 1)  motheduc = 0.0
 ( 2)  fatheduc = 0.0

       F(  2,  1185) =    1.44
            Prob > F =    0.2380
reg bwght cigs parity faminc if e(sample)

      Source |       SS       df       MS              Number of obs =    1191
-------------+------------------------------           F(  3,  1187) =   14.95
       Model |  17579.8997     3  5859.96658           Prob > F      =  0.0000
    Residual |  465166.792  1187  391.884408           R-squared     =  0.0364
-------------+------------------------------           Adj R-squared =  0.0340
       Total |  482746.692  1190  405.669489           Root MSE      =  19.796

------------------------------------------------------------------------------
       bwght |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        cigs |  -.5978519   .1087701    -5.50   0.000    -.8112549   -.3844489
      parity |   1.832274   .6575402     2.79   0.005     .5422035    3.122345
      faminc |   .0670618   .0323938     2.07   0.039     .0035063    .1306173
       _cons |   115.4699   1.655898    69.73   0.000     112.2211    118.7187
------------------------------------------------------------------------------

Example 4.10: Salary-Pension Tradeoff for Teachers

use http://fmwww.bc.edu/ec-p/data/wooldridge/meap93 
reg lsalary bensal lenrol lstaff droprate gradrate

  Source |       SS       df       MS                  Number of obs =     408
---------+------------------------------               F(  5,   402) =   45.43
   Model |  3.49912092     5  .699824185               Prob > F      =  0.0000
Residual |  6.19292056   402  .015405275               R-squared     =  0.3610
---------+------------------------------               Adj R-squared =  0.3531
   Total |  9.69204149   407   .02381337               Root MSE      =  .12412

------------------------------------------------------------------------------
 lsalary |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
  bensal |  -.5893175   .1648739     -3.574   0.000      -.9134402   -.2651948
 lenroll |   .0881206    .007324     12.032   0.000       .0737224    .1025187
  lstaff |  -.2182771   .0499504     -4.370   0.000      -.3164737   -.1200806
droprate |  -.0002826   .0016145     -0.175   0.861      -.0034565    .0028913
gradrate |   .0009674   .0006625      1.460   0.145      -.0003351    .0022699
   _cons |   10.73846   .2582652     41.579   0.000       10.23074    11.24618
------------------------------------------------------------------------------
reg lsalary bensal lenrol lstaff

  Source |       SS       df       MS                  Number of obs =     408
---------+------------------------------               F(  3,   404) =   73.39
   Model |  3.41865698     3  1.13955233               Prob > F      =  0.0000
Residual |  6.27338451   404  .015528179               R-squared     =  0.3527
---------+------------------------------               Adj R-squared =  0.3479
   Total |  9.69204149   407   .02381337               Root MSE      =  .12461

------------------------------------------------------------------------------
 lsalary |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
  bensal |  -.6047698   .1653685     -3.657   0.000      -.9298599   -.2796797
 lenroll |   .0873968   .0073462     11.897   0.000       .0729552    .1018385
  lstaff |  -.2220324   .0500774     -4.434   0.000      -.3204773   -.1235875
   _cons |   10.84383   .2516434     43.092   0.000       10.34914    11.33853
------------------------------------------------------------------------------
reg lsalary bensal 

  Source |       SS       df       MS                  Number of obs =     408
---------+------------------------------               F(  1,   406) =   17.05
   Model |  .390608607     1  .390608607               Prob > F      =  0.0000
Residual |  9.30143288   406  .022909933               R-squared     =  0.0403
---------+------------------------------               Adj R-squared =  0.0379
   Total |  9.69204149   407   .02381337               Root MSE      =  .15136

------------------------------------------------------------------------------
 lsalary |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
  bensal |  -.8253933    .199895     -4.129   0.000      -1.218352   -.4324349
   _cons |   10.52318   .0415602    253.203   0.000       10.44148    10.60488
------------------------------------------------------------------------------

This page prepared by Oleksandr Talavera (revised 8 Nov 2002)

Send your questions/comments/suggestions to Kit Baum at baum@bc.edu
These pages are maintained by the Faculty Micro Resource Center's GSA Program,
a unit of Boston College Academic Technology Services