Stata Textbook Examples
Introductory Econometrics: A Modern Approach by Jeffrey M. Wooldridge (1st & 2d eds.)
Chapter 2 - The Simple Regression Model

Example 2.3: CEO Salary and Return on Equity

use http://fmwww.bc.edu/ec-p/data/wooldridge/ceosal1 
summ salary roe
      
Variable |     Obs        Mean   Std. Dev.       Min        Max
---------+-----------------------------------------------------
  salary |     209     1281.12   1372.345        223      14822  
     roe |     209    17.18421   8.518509         .5       56.3  
reg salary roe

  Source |       SS       df       MS                  Number of obs =     209
---------+------------------------------               F(  1,   207) =    2.77
   Model |  5166419.04     1  5166419.04               Prob > F      =  0.0978
Residual |   386566563   207  1867471.32               R-squared     =  0.0132
---------+------------------------------               Adj R-squared =  0.0084
   Total |   391732982   208  1883331.64               Root MSE      =  1366.6

------------------------------------------------------------------------------
  salary |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
     roe |   18.50119   11.12325      1.663   0.098      -3.428195    40.43057
   _cons |   963.1913   213.2403      4.517   0.000       542.7902    1383.592
------------------------------------------------------------------------------

Salary for ROE = 0

display _b[roe]*0+_b[_cons]
963.19134

Salary for ROE = 30

display _b[roe]*30+_b[_cons]
1518.2269 

Example 2.4: Wage and Education

use http://fmwww.bc.edu/ec-p/data/wooldridge/wage1
summ wage
Variable |     Obs        Mean   Std. Dev.       Min        Max
---------+-----------------------------------------------------
    wage |     526    5.896103   3.693086        .53      24.98  
reg wage educ

  Source |       SS       df       MS                  Number of obs =     526
---------+------------------------------               F(  1,   524) =  103.36
   Model |  1179.73204     1  1179.73204               Prob > F      =  0.0000
Residual |  5980.68225   524  11.4135158               R-squared     =  0.1648
---------+------------------------------               Adj R-squared =  0.1632
   Total |  7160.41429   525  13.6388844               Root MSE      =  3.3784
------------------------------------------------------------------------------
    wage |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
    educ |   .5413593    .053248     10.167   0.000       .4367534    .6459651
   _cons |  -.9048516   .6849678     -1.321   0.187      -2.250472    .4407687
------------------------------------------------------------------------------

Wage for educ = 0

display _b[educ]*0+_b[_cons]
-.90485161 

Wage for educ = 8

display _b[educ]*8+_b[_cons]
3.4260224 

Return to 4 years education

display _b[educ]*4
2.165437

Example 2.5: Voting Outcomes and Campaign Expenditures

use http://fmwww.bc.edu/ec-p/data/wooldridge/vote1
reg voteA shareA

  Source |       SS       df       MS                  Number of obs =     173
---------+------------------------------               F(  1,   171) = 1017.70
   Model |  41486.4749     1  41486.4749               Prob > F      =  0.0000
Residual |  6970.77363   171  40.7647581               R-squared     =  0.8561
---------+------------------------------               Adj R-squared =  0.8553
   Total |  48457.2486   172  281.728189               Root MSE      =  6.3847

------------------------------------------------------------------------------
   voteA |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
  shareA |   .4638239   .0145393     31.901   0.000       .4351243    .4925234
   _cons |   26.81254   .8871887     30.222   0.000       25.06129    28.56379
------------------------------------------------------------------------------

Example 2.6: CEO Salary and Return on Equity

use http://fmwww.bc.edu/ec-p/data/wooldridge/ceosal1 
summ salary roe
      
Variable |     Obs        Mean   Std. Dev.       Min        Max
---------+-----------------------------------------------------
  salary |     209     1281.12   1372.345        223      14822  
     roe |     209    17.18421   8.518509         .5       56.3  
reg salary roe

  Source |       SS       df       MS                  Number of obs =     209
---------+------------------------------               F(  1,   207) =    2.77
   Model |  5166419.04     1  5166419.04               Prob > F      =  0.0978
Residual |   386566563   207  1867471.32               R-squared     =  0.0132
---------+------------------------------               Adj R-squared =  0.0084
   Total |   391732982   208  1883331.64               Root MSE      =  1366.6

------------------------------------------------------------------------------
  salary |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
     roe |   18.50119   11.12325      1.663   0.098      -3.428195    40.43057
   _cons |   963.1913   213.2403      4.517   0.000       542.7902    1383.592
------------------------------------------------------------------------------

Fitted Values and Residuals for the First 15 CEOs

predict salhat, xb
gen uhat=salary-salhat
list roe salary salhat uhat in 1/15
           roe     salary     salhat       uhat 
  1.      14.1       1095   1224.058  -129.0581  
  2.      10.9       1001   1164.854  -163.8542  
  3.      23.5       1122   1397.969  -275.9692  
  4.       5.9        578   1072.348  -494.3484  
  5.      13.8       1368   1218.508   149.4923  
  6.        20       1145   1333.215  -188.2151  
  7.      16.4       1078   1266.611  -188.6108  
  8.      16.3       1094   1264.761  -170.7606  
  9.      10.5       1237   1157.454   79.54626  
 10.      26.3        833   1449.773  -616.7726  
 11.      25.9        567   1442.372  -875.3721  
 12.      26.8        933   1459.023  -526.0231  
 13.      14.8       1339   1237.009   101.9911  
 14.      22.3        937   1375.768  -438.7678  
 15.      56.3       2011   2004.808   6.191895   

Example 2.7: Wage and Education

use http://fmwww.bc.edu/ec-p/data/wooldridge/wage1
summ wage educ
Variable |     Obs        Mean   Std. Dev.       Min        Max
---------+-----------------------------------------------------
    wage |     526    5.896103   3.693086        .53      24.98  
    educ |     526    12.56274   2.769022          0         18  
reg wage educ

  Source |       SS       df       MS                  Number of obs =     526
---------+------------------------------               F(  1,   524) =  103.36
   Model |  1179.73204     1  1179.73204               Prob > F      =  0.0000
Residual |  5980.68225   524  11.4135158               R-squared     =  0.1648
---------+------------------------------               Adj R-squared =  0.1632
   Total |  7160.41429   525  13.6388844               Root MSE      =  3.3784
------------------------------------------------------------------------------
    wage |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
    educ |   .5413593    .053248     10.167   0.000       .4367534    .6459651
   _cons |  -.9048516   .6849678     -1.321   0.187      -2.250472    .4407687
------------------------------------------------------------------------------

Wage for educ = 12.56

display _b[educ]*12.56+_b[_cons]
5.8824 

Example 2.8: CEO Salary and Return on Equity

use http://fmwww.bc.edu/ec-p/data/wooldridge/ceosal1 
reg salary roe

  Source |       SS       df       MS                  Number of obs =     209
---------+------------------------------               F(  1,   207) =    2.77
   Model |  5166419.04     1  5166419.04               Prob > F      =  0.0978
Residual |   386566563   207  1867471.32               R-squared     =  0.0132
---------+------------------------------               Adj R-squared =  0.0084
   Total |   391732982   208  1883331.64               Root MSE      =  1366.6

------------------------------------------------------------------------------
  salary |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
     roe |   18.50119   11.12325      1.663   0.098      -3.428195    40.43057
   _cons |   963.1913   213.2403      4.517   0.000       542.7902    1383.592
------------------------------------------------------------------------------

Example 2.9: Voting Outcomes and Campaign Expenditures

use http://fmwww.bc.edu/ec-p/data/wooldridge/vote1
reg voteA shareA

  Source |       SS       df       MS                  Number of obs =     173
---------+------------------------------               F(  1,   171) = 1017.70
   Model |  41486.4749     1  41486.4749               Prob > F      =  0.0000
Residual |  6970.77363   171  40.7647581               R-squared     =  0.8561
---------+------------------------------               Adj R-squared =  0.8553
   Total |  48457.2486   172  281.728189               Root MSE      =  6.3847

------------------------------------------------------------------------------
   voteA |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
  shareA |   .4638239   .0145393     31.901   0.000       .4351243    .4925234
   _cons |   26.81254   .8871887     30.222   0.000       25.06129    28.56379
------------------------------------------------------------------------------

Example 2.10: A Log Wage Equation

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

  Source |       SS       df       MS                  Number of obs =     526
---------+------------------------------               F(  1,   524) =  119.58
   Model |  27.5606296     1  27.5606296               Prob > F      =  0.0000
Residual |  120.769132   524  .230475443               R-squared     =  0.1858
---------+------------------------------               Adj R-squared =  0.1843
   Total |  148.329762   525   .28253288               Root MSE      =  .48008

------------------------------------------------------------------------------
   lwage |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
    educ |   .0827444   .0075667     10.935   0.000       .0678796    .0976092
   _cons |   .5837726   .0973358      5.998   0.000       .3925562     .774989
------------------------------------------------------------------------------

Example 2.11: CEO Salary and Firm Sales

use http://fmwww.bc.edu/ec-p/data/wooldridge/ceosal1 
reg lsalary lsales

  Source |       SS       df       MS                  Number of obs =     209
---------+------------------------------               F(  1,   207) =   55.30
   Model |  14.0661711     1  14.0661711               Prob > F      =  0.0000
Residual |  52.6559988   207  .254376806               R-squared     =  0.2108
---------+------------------------------               Adj R-squared =  0.2070
   Total |  66.7221699   208  .320779663               Root MSE      =  .50436

------------------------------------------------------------------------------
 lsalary |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
  lsales |   .2566717   .0345167      7.436   0.000       .1886225     .324721
   _cons |   4.821996   .2883397     16.723   0.000       4.253537    5.390455
------------------------------------------------------------------------------

Example 2.12: Student Math Performance and the School Lunch Program

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

  Source |       SS       df       MS                  Number of obs =     408
---------+------------------------------               F(  1,   406) =   83.77
   Model |  7665.26597     1  7665.26597               Prob > F      =  0.0000
Residual |  37151.9145   406  91.5071786               R-squared     =  0.1710
---------+------------------------------               Adj R-squared =  0.1690
   Total |  44817.1805   407  110.115923               Root MSE      =  9.5659

------------------------------------------------------------------------------
  math10 |      Coef.   Std. Err.       t     P>|t|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
 lnchprg |  -.3188643   .0348393     -9.152   0.000      -.3873523   -.2503763
   _cons |   32.14271   .9975824     32.221   0.000       30.18164    34.10378
------------------------------------------------------------------------------

This page prepared by Oleksandr Talavera (revised 13 Sep 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