Chapter 7 - Examples

------------------------------------------------------------------------------------------
      name:  SN
       log:  ~Wooldridge\intro-econx\iexample7.smcl
  log type:  smcl
 opened on:   9 Jan 2019, 00:27:17

  **********************************************
  * Solomon Negash - Replicating Examples
  * Wooldridge (2016). Introductory Econometrics: A Modern Approach. 6th ed.  
  * STATA Program, version 15.1. 

  * Chapter 7  - Multiple Regression Analysis with Qualitative Information
  * Computer Exercises (Examples)
  ******************** SETUP *********************

  *Example7.1. Hourly wage equation
  u wage1, clear
  reg wage female educ exper tenure
      Source |       SS           df       MS      Number of obs   =       526
-------------+----------------------------------   F(4, 521)       =     74.40
       Model |  2603.10658         4  650.776644   Prob > F        =    0.0000
    Residual |  4557.30771       521   8.7472317   R-squared       =    0.3635
-------------+----------------------------------   Adj R-squared   =    0.3587
       Total |  7160.41429       525  13.6388844   Root MSE        =    2.9576
------------------------------------------------------------------------------
        wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      female |  -1.810852   .2648252    -6.84   0.000    -2.331109   -1.290596
        educ |   .5715048   .0493373    11.58   0.000     .4745802    .6684293
       exper |   .0253959   .0115694     2.20   0.029     .0026674    .0481243
      tenure |   .1410051   .0211617     6.66   0.000     .0994323    .1825778
       _cons |  -1.567939   .7245511    -2.16   0.031    -2.991339    -.144538
------------------------------------------------------------------------------
  *b1 measures the average wage difference between men and women with the same level of educ,
exper and tenure. 
  reg wage female 
      Source |       SS           df       MS      Number of obs   =       526
-------------+----------------------------------   F(1, 524)       =     68.54
       Model |  828.220467         1  828.220467   Prob > F        =    0.0000
    Residual |  6332.19382       524  12.0843394   R-squared       =    0.1157
-------------+----------------------------------   Adj R-squared   =    0.1140
       Total |  7160.41429       525  13.6388844   Root MSE        =    3.4763
------------------------------------------------------------------------------
        wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      female |   -2.51183   .3034092    -8.28   0.000    -3.107878   -1.915782
       _cons |   7.099489   .2100082    33.81   0.000     6.686928     7.51205
------------------------------------------------------------------------------
  *b0 is the average wage for men in the sample.

  mean wage if female==0
Mean estimation                   Number of obs   =        274
--------------------------------------------------------------
             |       Mean   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
        wage |   7.099489   .2513666      6.604626    7.594352
--------------------------------------------------------------
  *b1 is the average wage difference between men and women, accounts no other factor

  mean wage if female==1
Mean estimation                   Number of obs   =        252
--------------------------------------------------------------
             |       Mean   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
        wage |   4.587659   .1593349      4.273855    4.901462
--------------------------------------------------------------
  display 4.5877 - 7.0995
-2.5118

  *Example7.2. Effect of computer ownership on collage GPA
  u gpa1, clear
  reg colGPA PC hsGPA ACT
      Source |       SS           df       MS      Number of obs   =       141
-------------+----------------------------------   F(3, 137)       =     12.83
       Model |  4.25741863         3  1.41913954   Prob > F        =    0.0000
    Residual |  15.1486808       137  .110574313   R-squared       =    0.2194
-------------+----------------------------------   Adj R-squared   =    0.2023
       Total |  19.4060994       140  .138614996   Root MSE        =    .33253
------------------------------------------------------------------------------
      colGPA |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          PC |   .1573092   .0572875     2.75   0.007     .0440271    .2705913
       hsGPA |   .4472417   .0936475     4.78   0.000     .2620603     .632423
         ACT |    .008659   .0105342     0.82   0.413    -.0121717    .0294897
       _cons |    1.26352   .3331255     3.79   0.000     .6047871    1.922253
------------------------------------------------------------------------------
  test hsGPA ACT
 ( 1)  hsGPA = 0
 ( 2)  ACT = 0
       F(  2,   137) =   14.86
            Prob > F =    0.0000

  reg colGPA PC 
      Source |       SS           df       MS      Number of obs   =       141
-------------+----------------------------------   F(1, 139)       =      7.31
       Model |  .970092892         1  .970092892   Prob > F        =    0.0077
    Residual |  18.4360066       139  .132633141   R-squared       =    0.0500
-------------+----------------------------------   Adj R-squared   =    0.0432
       Total |  19.4060994       140  .138614996   Root MSE        =    .36419
------------------------------------------------------------------------------
      colGPA |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          PC |   .1695168   .0626805     2.70   0.008     .0455864    .2934472
       _cons |   2.989412   .0395018    75.68   0.000      2.91131    3.067514
------------------------------------------------------------------------------

  mean colGPA if PC==0
Mean estimation                   Number of obs   =         85
--------------------------------------------------------------
             |       Mean   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
      colGPA |   2.989412   .0348676      2.920074     3.05875
--------------------------------------------------------------

  mean colGPA if PC==1
Mean estimation                   Number of obs   =         56
--------------------------------------------------------------
             |       Mean   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
      colGPA |   3.158929   .0562795      3.046142    3.271715
--------------------------------------------------------------
  display  3.158929 - 2.989412
 169517

  *Example7.3. Effect of Training Grants on hours of training
  u jtrain, clear
  reg hrsemp grant lsales lemploy if year==1988
      Source |       SS           df       MS      Number of obs   =       105
-------------+----------------------------------   F(3, 101)       =     10.44
       Model |  18622.7268         3  6207.57559   Prob > F        =    0.0000
    Residual |  60031.0921       101  594.367249   R-squared       =    0.2368
-------------+----------------------------------   Adj R-squared   =    0.2141
       Total |  78653.8189       104   756.28672   Root MSE        =     24.38
------------------------------------------------------------------------------
      hrsemp |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       grant |    26.2545   5.591765     4.70   0.000     15.16194    37.34705
      lsales |  -.9845809   3.539903    -0.28   0.781    -8.006797    6.037635
     lemploy |  -6.069871   3.882893    -1.56   0.121    -13.77249    1.632744
       _cons |   46.66508    43.4121     1.07   0.285    -39.45284     132.783
------------------------------------------------------------------------------

  *Example7.4. Housing price regression
  u hprice1, clear
  d llotsize lsqrft bdrm colonial
              storage   display    value
variable name   type    format     label      variable label
------------------------------------------------------------------------------------------
llotsize        float   %9.0g                 log(lotsize)
lsqrft          float   %9.0g                 log(sqrft)
bdrms           byte    %9.0g                 number of bdrms
colonial        byte    %9.0g                 =1 if home is colonial style

  reg lprice llotsize lsqrft bdrm colonial
      Source |       SS           df       MS      Number of obs   =        88
-------------+----------------------------------   F(4, 83)        =     38.38
       Model |  5.20397919         4   1.3009948   Prob > F        =    0.0000
    Residual |  2.81362433        83  .033899088   R-squared       =    0.6491
-------------+----------------------------------   Adj R-squared   =    0.6322
       Total |  8.01760352        87  .092156362   Root MSE        =    .18412
------------------------------------------------------------------------------
      lprice |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    llotsize |   .1678189   .0381807     4.40   0.000     .0918791    .2437587
      lsqrft |   .7071931    .092802     7.62   0.000     .5226138    .8917725
       bdrms |   .0268305   .0287236     0.93   0.353    -.0302995    .0839605
    colonial |   .0537962   .0447732     1.20   0.233     -.035256    .1428483
       _cons |  -1.349589    .651041    -2.07   0.041    -2.644483   -.0546947
------------------------------------------------------------------------------

  *Example7.5. Hourly wage equation
  u wage1, clear
  reg lwage female educ exper* tenur*
      Source |       SS           df       MS      Number of obs   =       526
-------------+----------------------------------   F(6, 519)       =     68.18
       Model |  65.3791009         6  10.8965168   Prob > F        =    0.0000
    Residual |  82.9506505       519  .159827843   R-squared       =    0.4408
-------------+----------------------------------   Adj R-squared   =    0.4343
       Total |  148.329751       525   .28253286   Root MSE        =    .39978
------------------------------------------------------------------------------
       lwage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      female |   -.296511   .0358055    -8.28   0.000    -.3668524   -.2261696
        educ |   .0801967   .0067573    11.87   0.000     .0669217    .0934716
       exper |   .0294324   .0049752     5.92   0.000     .0196585    .0392063
     expersq |  -.0005827   .0001073    -5.43   0.000    -.0007935   -.0003719
      tenure |   .0317139   .0068452     4.63   0.000     .0182663    .0451616
     tenursq |  -.0005852   .0002347    -2.49   0.013    -.0010463   -.0001241
       _cons |    .416691   .0989279     4.21   0.000     .2223425    .6110394
------------------------------------------------------------------------------
  display exp(-.297) -1 
-.25695599

  *Example7.6. Hourly wage equation
  u wage1, clear
  g marrmale = (female==0 & married==1)
  g marrfem = (female==1 & married==1)
  g singfem = (female==1 & married==0)
  g singmen = (female==0 & married==0)
  reg lwage marrmale marrfem singfem educ exper* tenur* 
      Source |       SS           df       MS      Number of obs   =       526
-------------+----------------------------------   F(8, 517)       =     55.25
       Model |  68.3617623         8  8.54522029   Prob > F        =    0.0000
    Residual |  79.9679891       517  .154676961   R-squared       =    0.4609
-------------+----------------------------------   Adj R-squared   =    0.4525
       Total |  148.329751       525   .28253286   Root MSE        =    .39329
------------------------------------------------------------------------------
       lwage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    marrmale |   .2126757   .0553572     3.84   0.000      .103923    .3214284
     marrfem |  -.1982676   .0578355    -3.43   0.001     -.311889   -.0846462
     singfem |  -.1103502   .0557421    -1.98   0.048     -.219859   -.0008414
        educ |   .0789103   .0066945    11.79   0.000     .0657585     .092062
       exper |   .0268006   .0052428     5.11   0.000     .0165007    .0371005
     expersq |  -.0005352   .0001104    -4.85   0.000    -.0007522   -.0003183
      tenure |   .0290875    .006762     4.30   0.000     .0158031    .0423719
     tenursq |  -.0005331   .0002312    -2.31   0.022    -.0009874   -.0000789
       _cons |   .3213781    .100009     3.21   0.001     .1249041    .5178521
------------------------------------------------------------------------------

  reg lwage marrmale singmen singfem educ exper* tenur* 
      Source |       SS           df       MS      Number of obs   =       526
-------------+----------------------------------   F(8, 517)       =     55.25
       Model |  68.3617623         8  8.54522029   Prob > F        =    0.0000
    Residual |  79.9679891       517  .154676961   R-squared       =    0.4609
-------------+----------------------------------   Adj R-squared   =    0.4525
       Total |  148.329751       525   .28253286   Root MSE        =    .39329
------------------------------------------------------------------------------
       lwage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    marrmale |   .4109433   .0457709     8.98   0.000     .3210234    .5008631
     singmen |   .1982676   .0578355     3.43   0.001     .0846462     .311889
     singfem |   .0879174   .0523481     1.68   0.094    -.0149238    .1907586
        educ |   .0789103   .0066945    11.79   0.000     .0657585     .092062
       exper |   .0268006   .0052428     5.11   0.000     .0165007    .0371005
     expersq |  -.0005352   .0001104    -4.85   0.000    -.0007522   -.0003183
      tenure |   .0290875    .006762     4.30   0.000     .0158031    .0423719
     tenursq |  -.0005331   .0002312    -2.31   0.022    -.0009874   -.0000789
       _cons |   .1231105   .1057937     1.16   0.245    -.0847279    .3309488
------------------------------------------------------------------------------
 




  *Example7.7. Effects of physical attractiveness on wage
  use beauty, clear
(Written by R.              )
  /* if the file is not available in your folder, export it from R using the following script
 (assuming you have R installed in your PC, otherwise you may skip this):  
install.packages("wooldridge")
library(wooldridge)
data("beauty") 
require(foreign)
write.dta(beauty, "YOUR CURRENT DIRECTORY/beauty.dta")
*/
  reg lwage belavg abvavg educ exper* union married black south good if female==0
      Source |       SS           df       MS      Number of obs   =       824
-------------+----------------------------------   F(10, 813)      =     27.82
       Model |   61.226435        10   6.1226435   Prob > F        =    0.0000
    Residual |  178.934819       813  .220092028   R-squared       =    0.2549
-------------+----------------------------------   Adj R-squared   =    0.2458
       Total |  240.161253       823  .291811973   Root MSE        =    .46914
------------------------------------------------------------------------------
       lwage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      belavg |  -.1647273   .0529083    -3.11   0.002    -.2685803   -.0608742
      abvavg |  -.0249691   .0377393    -0.66   0.508    -.0990471    .0491089
        educ |   .0606609   .0065805     9.22   0.000     .0477442    .0735776
       exper |    .046392   .0057854     8.02   0.000     .0350359     .057748
     expersq |  -.0007263   .0001234    -5.88   0.000    -.0009686    -.000484
       union |   .1485369    .036234     4.10   0.000     .0774136    .2196602
     married |   .0643684   .0442547     1.45   0.146    -.0224985    .1512353
       black |  -.2569891   .0756565    -3.40   0.001    -.4054942   -.1084839
       south |   .0852807    .042827     1.99   0.047     .0012161    .1693452
    goodhlth |   .0011008   .0701752     0.02   0.987    -.1366451    .1388467
       _cons |   .4777672    .120344     3.97   0.000     .2415456    .7139888
------------------------------------------------------------------------------

  reg lwage belavg abvavg educ exper* union married black south good if female==1
      Source |       SS           df       MS      Number of obs   =       436
-------------+----------------------------------   F(10, 425)      =     16.40
       Model |  33.3026496        10  3.33026496   Prob > F        =    0.0000
    Residual |  86.3098141       425  .203081915   R-squared       =    0.2784
-------------+----------------------------------   Adj R-squared   =    0.2614
       Total |  119.612464       435  .274971181   Root MSE        =    .45065
------------------------------------------------------------------------------
       lwage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      belavg |  -.1141864    .066479    -1.72   0.087    -.2448548    .0164821
      abvavg |   .0685726   .0490607     1.40   0.163    -.0278592    .1650045
        educ |   .0756932   .0089025     8.50   0.000     .0581947    .0931917
       exper |   .0294842   .0071753     4.11   0.000     .0153807    .0435877
     expersq |  -.0004941   .0001756    -2.81   0.005    -.0008393   -.0001489
       union |   .2927388    .053905     5.43   0.000     .1867852    .3986925
     married |  -.0622614    .044332    -1.40   0.161    -.1493986    .0248759
       black |   .1437631   .0688923     2.09   0.038     .0083511    .2791751
       south |    .008481   .0595609     0.14   0.887    -.1085897    .1255516
    goodhlth |   .1130952    .081308     1.39   0.165    -.0467206     .272911
       _cons |   -.077281   .1441897    -0.54   0.592    -.3606948    .2061328
------------------------------------------------------------------------------

  *Example7.8. Effects of law school rankings on starting salaries
  u lawsch85, clear
  g r61_100= (rank>=61 & rank<=100)
  reg lsalary top10 r11_25 r26_40 r41_60 r61_100 LSAT GPA llibvol lcost
      Source |       SS           df       MS      Number of obs   =       136
-------------+----------------------------------   F(9, 126)       =    143.20
       Model |  9.45224101         9    1.050249   Prob > F        =    0.0000
    Residual |  .924110799       126  .007334213   R-squared       =    0.9109
-------------+----------------------------------   Adj R-squared   =    0.9046
       Total |  10.3763518       135  .076861865   Root MSE        =    .08564
------------------------------------------------------------------------------
     lsalary |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       top10 |   .6995659    .053492    13.08   0.000     .5937069    .8054249
      r11_25 |   .5935433     .03944    15.05   0.000     .5154926     .671594
      r26_40 |   .3750763   .0340812    11.01   0.000     .3076305     .442522
      r41_60 |    .262819   .0279621     9.40   0.000     .2074829    .3181551
     r61_100 |   .1315949   .0210419     6.25   0.000     .0899537    .1732361
        LSAT |   .0056909    .003063     1.86   0.066    -.0003707    .0117525
         GPA |   .0137257   .0741919     0.19   0.854    -.1330979    .1605494
     llibvol |   .0363619   .0260165     1.40   0.165     -.015124    .0878478
       lcost |   .0008411    .025136     0.03   0.973    -.0489024    .0505846
       _cons |   9.165294   .4114243    22.28   0.000     8.351098    9.979491
------------------------------------------------------------------------------
  test LSAT GPA llibvol lcost
 ( 1)  LSAT = 0
 ( 2)  GPA = 0
 ( 3)  llibvol = 0
 ( 4)  lcost = 0
       F(  4,   126) =    2.39
            Prob > F =    0.0547
  display exp(0.6996)-1 
1.0129474

  *Example7.9. Effects of computer usage on wages
  *No data. Link to original article - Kruger 1995, https://www.nber.org/papers/w3858.pdf
  *Example7.10. Log hourly wage equation
  u wage1, clear
  reg lwage c.female##c.educ exper* tenur*
      Source |       SS           df       MS      Number of obs   =       526
-------------+----------------------------------   F(7, 518)       =     58.37
       Model |  65.4081534         7  9.34402192   Prob > F        =    0.0000
    Residual |   82.921598       518  .160080305   R-squared       =    0.4410
-------------+----------------------------------   Adj R-squared   =    0.4334
       Total |  148.329751       525   .28253286   Root MSE        =     .4001
---------------------------------------------------------------------------------
          lwage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------+----------------------------------------------------------------
         female |  -.2267886   .1675394    -1.35   0.176    -.5559289    .1023517
           educ |   .0823692   .0084699     9.72   0.000     .0657296    .0990088
c.female#c.educ |  -.0055645   .0130618    -0.43   0.670    -.0312252    .0200962
          exper |   .0293366   .0049842     5.89   0.000      .019545    .0391283
        expersq |  -.0005804   .0001075    -5.40   0.000    -.0007916   -.0003691
         tenure |   .0318967    .006864     4.65   0.000      .018412    .0453814
        tenursq |    -.00059   .0002352    -2.51   0.012     -.001052    -.000128
          _cons |    .388806   .1186871     3.28   0.001     .1556388    .6219732
---------------------------------------------------------------------------------
  test female c.female#c.educ 
 ( 1)  female = 0
 ( 2)  c.female#c.educ = 0
       F(  2,   518) =   34.33
            Prob > F =    0.0000

  *Example7.11. Effects of race on baseball player salaries
  u mlb1, clear
  reg lsalary years gamesyr bavg hrunsyr rbisyr runsyr fldperc allstar black hispan c.blac
> k#c.percblck c.hispan#c.perchisp if percblck !=.
      Source |       SS           df       MS      Number of obs   =       330
-------------+----------------------------------   F(12, 317)      =     46.48
       Model |  283.782162        12  23.6485135   Prob > F        =    0.0000
    Residual |    161.2793       317  .508767508   R-squared       =    0.6376
-------------+----------------------------------   Adj R-squared   =    0.6239
       Total |  445.061462       329   1.3527704   Root MSE        =    .71328
-------------------------------------------------------------------------------------
            lsalary |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
--------------------+----------------------------------------------------------------
              years |   .0673458   .0128915     5.22   0.000     .0419822    .0927094
            gamesyr |   .0088778   .0033837     2.62   0.009     .0022205    .0155352
               bavg |   .0009451   .0015133     0.62   0.533    -.0020322    .0039225
            hrunsyr |   .0146206   .0164522     0.89   0.375    -.0177488      .04699
             rbisyr |   .0044938    .007575     0.59   0.553    -.0104098    .0193974
             runsyr |   .0072029   .0045671     1.58   0.116    -.0017827    .0161885
            fldperc |   .0010865   .0021195     0.51   0.609    -.0030835    .0052566
            allstar |   .0075307   .0028735     2.62   0.009     .0018771    .0131842
              black |   -.198008   .1254968    -1.58   0.116    -.4449199    .0489038
             hispan |  -.1900089   .1530902    -1.24   0.215    -.4912101    .1111923
 c.black#c.percblck |   .0124513   .0049628     2.51   0.013     .0026872    .0222154
c.hispan#c.perchisp |   .0200863   .0097933     2.05   0.041     .0008182    .0393543
              _cons |   10.34368   2.182538     4.74   0.000     6.049594    14.63777
-------------------------------------------------------------------------------------
  test black hispan c.black#c.percblck c.hispan#c.perchisp 
 ( 1)  black = 0
 ( 2)  hispan = 0
 ( 3)  c.black#c.percblck = 0
 ( 4)  c.hispan#c.perchisp = 0
       F(  4,   317) =    2.65
            Prob > F =    0.0335

  reg lsalary years gamesyr bavg hrunsyr rbisyr runsyr fldperc allstar if percblck !=.
      Source |       SS           df       MS      Number of obs   =       330
-------------+----------------------------------   F(8, 321)       =     67.02
       Model |  278.393524         8  34.7991905   Prob > F        =    0.0000
    Residual |  166.667938       321   .51921476   R-squared       =    0.6255
-------------+----------------------------------   Adj R-squared   =    0.6162
       Total |  445.061462       329   1.3527704   Root MSE        =    .72057
------------------------------------------------------------------------------
     lsalary |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       years |   .0672522   .0129735     5.18   0.000     .0417284     .092776
     gamesyr |    .008581   .0033684     2.55   0.011     .0019541    .0152078
        bavg |    .000654   .0015022     0.44   0.664    -.0023014    .0036095
     hrunsyr |   .0140303    .016539     0.85   0.397    -.0185083    .0465689
      rbisyr |    .004629   .0076231     0.61   0.544    -.0103684    .0196265
      runsyr |   .0084125    .004502     1.87   0.063    -.0004446    .0172695
     fldperc |   .0008579   .0021373     0.40   0.688     -.003347    .0050629
     allstar |   .0068969    .002886     2.39   0.017     .0012189    .0125748
       _cons |   10.63671   2.198683     4.84   0.000      6.31106    14.96236
------------------------------------------------------------------------------

  *Equation [7.22]
  u gpa3, clear
  reg cumgpa c.female##c.sat hsperc c.female#c.hsperc tothrs c.femal#c.tothrs if spring==1
      Source |       SS           df       MS      Number of obs   =       366
-------------+----------------------------------   F(7, 358)       =     34.95
       Model |  53.5391808         7   7.6484544   Prob > F        =    0.0000
    Residual |  78.3545052       358  .218867333   R-squared       =    0.4059
-------------+----------------------------------   Adj R-squared   =    0.3943
       Total |  131.893686       365  .361352564   Root MSE        =    .46783
-----------------------------------------------------------------------------------
           cumgpa |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------+----------------------------------------------------------------
           female |  -.3534862   .4105293    -0.86   0.390    -1.160838    .4538659
              sat |   .0010516   .0001811     5.81   0.000     .0006955    .0014078
   c.female#c.sat |   .0007506   .0003852     1.95   0.052    -6.88e-06    .0015081
           hsperc |  -.0084516   .0013704    -6.17   0.000    -.0111465   -.0057566
c.female#c.hsperc |  -.0005498   .0031617    -0.17   0.862    -.0067676    .0056681
           tothrs |   .0023441   .0008624     2.72   0.007     .0006482    .0040401
c.female#c.tothrs |  -.0001158   .0016277    -0.07   0.943    -.0033169    .0030852
            _cons |   1.480812   .2073336     7.14   0.000     1.073067    1.888557
-----------------------------------------------------------------------------------
  test c.female#c.sat  c.female#c.hsperc  c.femal#c.tothrs 
 ( 1)  c.female#c.sat = 0
 ( 2)  c.female#c.hsperc = 0
 ( 3)  c.female#c.tothrs = 0
       F(  3,   358) =    1.53
            Prob > F =    0.2054

  *Equation [7.25]
  reg cumgpa female sat  hsperc  tothrs  if spring==1
      Source |       SS           df       MS      Number of obs   =       366
-------------+----------------------------------   F(4, 361)       =     59.74
       Model |  52.5320205         4  13.1330051   Prob > F        =    0.0000
    Residual |  79.3616656       361  .219838409   R-squared       =    0.3983
-------------+----------------------------------   Adj R-squared   =    0.3916
       Total |  131.893686       365  .361352564   Root MSE        =    .46887
------------------------------------------------------------------------------
      cumgpa |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      female |   .3100975   .0586128     5.29   0.000     .1948321    .4253629
         sat |   .0012144   .0001591     7.63   0.000     .0009016    .0015272
      hsperc |  -.0084413   .0012343    -6.84   0.000    -.0108687   -.0060139
      tothrs |   .0024638   .0007291     3.38   0.001       .00103    .0038976
       _cons |   1.328541   .1798275     7.39   0.000     .9748996    1.682182
------------------------------------------------------------------------------

  *Equation [7.29]
  u mroz, clear
  reg inlf nwifeinc educ exper* age kidslt6 kidsge6
      Source |       SS           df       MS      Number of obs   =       753
-------------+----------------------------------   F(7, 745)       =     38.22
       Model |  48.8080578         7  6.97257969   Prob > F        =    0.0000
    Residual |  135.919698       745  .182442547   R-squared       =    0.2642
-------------+----------------------------------   Adj R-squared   =    0.2573
       Total |  184.727756       752  .245648611   Root MSE        =    .42713
------------------------------------------------------------------------------
        inlf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    nwifeinc |  -.0034052   .0014485    -2.35   0.019    -.0062488   -.0005616
        educ |   .0379953    .007376     5.15   0.000      .023515    .0524756
       exper |   .0394924   .0056727     6.96   0.000     .0283561    .0506287
     expersq |  -.0005963   .0001848    -3.23   0.001    -.0009591   -.0002335
         age |  -.0160908   .0024847    -6.48   0.000    -.0209686    -.011213
     kidslt6 |  -.2618105   .0335058    -7.81   0.000    -.3275875   -.1960335
     kidsge6 |   .0130122    .013196     0.99   0.324    -.0128935    .0389179
       _cons |   .5855192    .154178     3.80   0.000     .2828442    .8881943
------------------------------------------------------------------------------

  *Example7.12. A linear probability model of arrest
  u crime1, clear
  g arr86 = (narr>0) 
  reg arr86 pcnv avgsen tottime ptime qemp 
      Source |       SS           df       MS      Number of obs   =     2,725
-------------+----------------------------------   F(5, 2719)      =     27.03
       Model |  25.8452455         5  5.16904909   Prob > F        =    0.0000
    Residual |  519.971268     2,719  .191236215   R-squared       =    0.0474
-------------+----------------------------------   Adj R-squared   =    0.0456
       Total |  545.816514     2,724   .20037317   Root MSE        =    .43731
------------------------------------------------------------------------------
       arr86 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        pcnv |  -.1624448   .0212368    -7.65   0.000    -.2040866    -.120803
      avgsen |   .0061127    .006452     0.95   0.344    -.0065385     .018764
     tottime |  -.0022616   .0049781    -0.45   0.650    -.0120229    .0074997
     ptime86 |  -.0219664   .0046349    -4.74   0.000    -.0310547   -.0128781
      qemp86 |  -.0428294   .0054046    -7.92   0.000    -.0534268   -.0322319
       _cons |   .4406154   .0172329    25.57   0.000     .4068246    .4744063
------------------------------------------------------------------------------
  test avgsen tottime
 ( 1)  avgsen = 0
 ( 2)  tottime = 0
       F(  2,  2719) =    1.06
            Prob > F =    0.3467

  *Equation [7.32]
  reg arr86 pcnv avgsen tottime ptime qemp black hispan
      Source |       SS           df       MS      Number of obs   =     2,725
-------------+----------------------------------   F(7, 2717)      =     28.41
       Model |  37.2205275         7  5.31721822   Prob > F        =    0.0000
    Residual |  508.595986     2,717  .187190278   R-squared       =    0.0682
-------------+----------------------------------   Adj R-squared   =    0.0658
       Total |  545.816514     2,724   .20037317   Root MSE        =    .43265
------------------------------------------------------------------------------
       arr86 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        pcnv |   -.152062   .0210655    -7.22   0.000     -.193368   -.1107561
      avgsen |   .0046191   .0063888     0.72   0.470    -.0079083    .0171465
     tottime |  -.0025619   .0049259    -0.52   0.603    -.0122207    .0070969
     ptime86 |  -.0236954   .0045948    -5.16   0.000     -.032705   -.0146858
      qemp86 |  -.0384737   .0054016    -7.12   0.000    -.0490653   -.0278821
       black |   .1697631   .0236738     7.17   0.000     .1233426    .2161836
      hispan |   .0961866   .0207105     4.64   0.000     .0555766    .1367965
       _cons |   .3804283   .0187272    20.31   0.000     .3437073    .4171493
------------------------------------------------------------------------------

  *Equation [7.33]
  u jtrain, clear
  reg lscrap grant lsales lemploy if year==1988
      Source |       SS           df       MS      Number of obs   =        50
-------------+----------------------------------   F(3, 46)        =      1.18
       Model |   6.8054029         3  2.26846763   Prob > F        =    0.3270
    Residual |  88.2852083        46  1.91924366   R-squared       =    0.0716
-------------+----------------------------------   Adj R-squared   =    0.0110
       Total |  95.0906112        49  1.94062472   Root MSE        =    1.3854
------------------------------------------------------------------------------
      lscrap |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       grant |  -.0517781   .4312869    -0.12   0.905    -.9199137    .8163574
      lsales |  -.4548425   .3733152    -1.22   0.229    -1.206287    .2966021
     lemploy |   .6394289   .3651366     1.75   0.087     -.095553    1.374411
       _cons |   4.986779   4.655588     1.07   0.290    -4.384433    14.35799
------------------------------------------------------------------------------

  *Equation [7.35] & [7.37]
  u fertil2, clear
  reg children age educ 
      Source |       SS           df       MS      Number of obs   =     4,361
-------------+----------------------------------   F(2, 4358)      =   2767.70
       Model |  12044.5522         2  6022.27608   Prob > F        =    0.0000
    Residual |  9482.62417     4,358  2.17591193   R-squared       =    0.5595
-------------+----------------------------------   Adj R-squared   =    0.5593
       Total |  21527.1763     4,360  4.93742577   Root MSE        =    1.4751
------------------------------------------------------------------------------
    children |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |   .1748306   .0027051    64.63   0.000     .1695273    .1801339
        educ |  -.0899397   .0059826   -15.03   0.000    -.1016686   -.0782108
       _cons |   -1.99675   .0939688   -21.25   0.000    -2.180976   -1.812523
------------------------------------------------------------------------------

  reg children age educ electric
      Source |       SS           df       MS      Number of obs   =     4,358
-------------+----------------------------------   F(3, 4354)      =   1862.83
       Model |   12090.395         3  4030.13167   Prob > F        =    0.0000
    Residual |   9419.6371     4,354  2.16344444   R-squared       =    0.5621
-------------+----------------------------------   Adj R-squared   =    0.5618
       Total |  21510.0321     4,357  4.93689055   Root MSE        =    1.4709
------------------------------------------------------------------------------
    children |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         age |   .1769991   .0027291    64.86   0.000     .1716486    .1823496
        educ |  -.0787507   .0063195   -12.46   0.000      -.09114   -.0663614
    electric |  -.3617579   .0680316    -5.32   0.000    -.4951345   -.2283813
       _cons |  -2.071091   .0947413   -21.86   0.000    -2.256832    -1.88535
------------------------------------------------------------------------------

  log close
      name:  SN
       log:  ~Wooldridge\intro-econx\iexample7.smcl
  log type:  smcl
 closed on:   9 Jan 2019, 00:27:17
------------------------------------------------------------------------------------------