Stata Textbook Examples
Introductory Econometrics: A Modern Approach by Jeffrey M. Wooldridge (1st & 2nd eds.)
Chapter 10 - Basic Regression Analysis with Time Series Data

Example 10.1: Static Phillips Curve

use http://fmwww.bc.edu/ec-p/data/wooldridge/phillips
reg inf unem

      Source |       SS       df       MS              Number of obs =      49
-------------+------------------------------           F(  1,    47) =    2.62
       Model |  25.6369575     1  25.6369575           Prob > F      =  0.1125
    Residual |   460.61979    47  9.80042107           R-squared     =  0.0527
-------------+------------------------------           Adj R-squared =  0.0326
       Total |  486.256748    48  10.1303489           Root MSE      =  3.1306

------------------------------------------------------------------------------
         inf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        unem |   .4676257   .2891262     1.62   0.112    -.1140212    1.049273
       _cons |    1.42361   1.719015     0.83   0.412    -2.034602    4.881822
------------------------------------------------------------------------------

Example 10.2: Effects of Inflation and Deficits on Interst Rates

use http://fmwww.bc.edu/ec-p/data/wooldridge/intdef
reg i3 inf def

      Source |       SS       df       MS              Number of obs =      49
-------------+------------------------------           F(  2,    46) =   52.78
       Model |  294.032897     2  147.016449           Prob > F      =  0.0000
    Residual |  128.133943    46  2.78552049           R-squared     =  0.6965
-------------+------------------------------           Adj R-squared =  0.6833
       Total |   422.16684    48   8.7951425           Root MSE      =   1.669

------------------------------------------------------------------------------
          i3 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         inf |   .6131825   .0757753     8.09   0.000     .4606547    .7657104
         def |   .7004054     .11807     5.93   0.000     .4627427     .938068
       _cons |   1.252032   .4416346     2.83   0.007     .3630674    2.140996
------------------------------------------------------------------------------

Example 10.3: Puerto Rican Employment and the Minimum Wage

use http://fmwww.bc.edu/ec-p/data/wooldridge/prminwge
reg lprepop lmincov lusgnp

      Source |       SS       df       MS              Number of obs =      38
-------------+------------------------------           F(  2,    35) =   34.04
       Model |  .211258194     2  .105629097           Prob > F      =  0.0000
    Residual |  .108600157    35  .003102862           R-squared     =  0.6605
-------------+------------------------------           Adj R-squared =  0.6411
       Total |  .319858351    37   .00864482           Root MSE      =   .0557

------------------------------------------------------------------------------
     lprepop |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     lmincov |  -.1544433   .0649015    -2.38   0.023    -.2862003   -.0226863
      lusgnp |  -.0121899   .0885134    -0.14   0.891    -.1918817    .1675019
       _cons |  -1.054413   .7654066    -1.38   0.177    -2.608271    .4994452
------------------------------------------------------------------------------

Example 10.4: Effects of Personal Exemption on Fertility Rates

use http://fmwww.bc.edu/ec-p/data/wooldridge/fertil3
summ pe

    Variable |     Obs        Mean   Std. Dev.       Min        Max
-------------+-----------------------------------------------------
          pe |      72    100.4015   65.87563          0     243.83
reg gfr pe ww2 pill

      Source |       SS       df       MS              Number of obs =      72
-------------+------------------------------           F(  3,    68) =   20.38
       Model |  13183.6215     3  4394.54049           Prob > F      =  0.0000
    Residual |  14664.2739    68  215.651087           R-squared     =  0.4734
-------------+------------------------------           Adj R-squared =  0.4502
       Total |  27847.8954    71  392.223879           Root MSE      =  14.685

------------------------------------------------------------------------------
         gfr |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          pe |     .08254   .0296462     2.78   0.007     .0233819    .1416981
         ww2 |   -24.2384   7.458253    -3.25   0.002    -39.12111   -9.355684
        pill |  -31.59403   4.081068    -7.74   0.000    -39.73768   -23.45039
       _cons |   98.68176   3.208129    30.76   0.000     92.28003    105.0835
------------------------------------------------------------------------------
reg gfr pe ww2 pill pe_1 pe_2

      Source |       SS       df       MS              Number of obs =      70
-------------+------------------------------           F(  5,    64) =   12.73
       Model |  12959.7886     5  2591.95772           Prob > F      =  0.0000
    Residual |  13032.6443    64  203.635067           R-squared     =  0.4986
-------------+------------------------------           Adj R-squared =  0.4594
       Total |  25992.4329    69  376.701926           Root MSE      =   14.27

------------------------------------------------------------------------------
         gfr |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          pe |   .0726718   .1255331     0.58   0.565    -.1781094     .323453
         ww2 |   -22.1265   10.73197    -2.06   0.043    -43.56608   -.6869198
        pill |  -31.30499   3.981559    -7.86   0.000    -39.25907   -23.35091
        pe_1 |  -.0057796   .1556629    -0.04   0.970     -.316752    .3051929
        pe_2 |   .0338268   .1262574     0.27   0.790    -.2184013     .286055
       _cons |    95.8705   3.281957    29.21   0.000     89.31403     102.427
------------------------------------------------------------------------------
test pe_1 pe_2

 ( 1)  pe_1 = 0.0
 ( 2)  pe_2 = 0.0

       F(  2,    64) =    0.05
            Prob > F =    0.9480

Estimated LRP

display _b[pe]+_b[pe_1]+_b[pe_2]
.10071909
gen dif1=pe_1-pe
gen dif2=pe_2-pe
reg gfr pe dif1 dif2 ww2 pill

      Source |       SS       df       MS              Number of obs =      70
-------------+------------------------------           F(  5,    64) =   12.73
       Model |  12959.7886     5  2591.95772           Prob > F      =  0.0000
    Residual |  13032.6443    64  203.635067           R-squared     =  0.4986
-------------+------------------------------           Adj R-squared =  0.4594
       Total |  25992.4329    69  376.701926           Root MSE      =   14.27

------------------------------------------------------------------------------
         gfr |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          pe |   .1007191   .0298027     3.38   0.001     .0411814    .1602568
        dif1 |  -.0057796   .1556629    -0.04   0.970     -.316752    .3051929
        dif2 |   .0338268   .1262574     0.27   0.790    -.2184013     .286055
         ww2 |   -22.1265   10.73197    -2.06   0.043    -43.56608   -.6869198
        pill |  -31.30499   3.981559    -7.86   0.000    -39.25907   -23.35091
       _cons |    95.8705   3.281957    29.21   0.000     89.31403     102.427
------------------------------------------------------------------------------

Example 10.5: Antidumping Filings and Chemical Import

use http://fmwww.bc.edu/ec-p/data/wooldridge/barium
reg lchnimp lchempi lgas lrtwex befile6 affile6 afdec6

      Source |       SS       df       MS              Number of obs =     131
-------------+------------------------------           F(  6,   124) =    9.06
       Model |  19.4051456     6  3.23419093           Prob > F      =  0.0000
    Residual |  44.2471061   124  .356831501           R-squared     =  0.3049
-------------+------------------------------           Adj R-squared =  0.2712
       Total |  63.6522517   130  .489632706           Root MSE      =  .59735

------------------------------------------------------------------------------
     lchnimp |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     lchempi |     3.1172    .479202     6.50   0.000     2.168725    4.065675
        lgas |   .1963049   .9066233     0.22   0.829    -1.598157    1.990766
      lrtwex |   .9830093   .4001536     2.46   0.015     .1909934    1.775025
     befile6 |   .0595742     .26097     0.23   0.820    -.4569584    .5761068
     affile6 |  -.0324067   .2642973    -0.12   0.903    -.5555252    .4907118
      afdec6 |  -.5652446   .2858353    -1.98   0.050    -1.130993    .0005035
       _cons |  -17.80195   21.04551    -0.85   0.399    -59.45692    23.85301
------------------------------------------------------------------------------

Change in Chinese export of barium

display 100*(exp(_b[afdec6])-1)
-43.177885

Example 10.6: Election Outcomes and Economic Performance

use http://fmwww.bc.edu/ec-p/data/wooldridge/fair
reg demvote partyWH incum pWHgnews  pWHinf if year<1996


      Source |       SS       df       MS              Number of obs =      20
-------------+------------------------------           F(  4,    15) =    7.37
       Model |  .072465402     4  .018116351           Prob > F      =  0.0017
    Residual |  .036853881    15  .002456925           R-squared     =  0.6629
-------------+------------------------------           Adj R-squared =  0.5730
       Total |  .109319283    19  .005753646           Root MSE      =  .04957

------------------------------------------------------------------------------
     demvote |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     partyWH |  -.0434752    .040459    -1.07   0.300    -.1297114    .0427611
       incum |   .0543902   .0234166     2.32   0.035      .004479    .1043014
    pWHgnews |   .0108466   .0041267     2.63   0.019     .0020508    .0196424
      pWHinf |  -.0077017   .0032567    -2.36   0.032    -.0146432   -.0007602
       _cons |    .481062   .0122631    39.23   0.000     .4549238    .5072002
------------------------------------------------------------------------------

Predicted value of demvote

display _b[_cons]+_b[partyWH]+_b[incum]+_b[pWHgnews]*3+_b[pWHinf]*3.019
.5012655

Example 10.7: Housing Investment and Prices

use http://fmwww.bc.edu/ec-p/data/wooldridge/hseinv
reg linvpc lprice

      Source |       SS       df       MS              Number of obs =      42
-------------+------------------------------           F(  1,    40) =   10.53
       Model |  .254364572     1  .254364572           Prob > F      =  0.0024
    Residual |  .966255373    40  .024156384           R-squared     =  0.2084
-------------+------------------------------           Adj R-squared =  0.1886
       Total |  1.22061994    41  .029771218           Root MSE      =  .15542

------------------------------------------------------------------------------
      linvpc |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      lprice |   1.240944   .3824192     3.24   0.002     .4680455    2.013842
       _cons |  -.5502345   .0430266   -12.79   0.000    -.6371945   -.4632745
------------------------------------------------------------------------------
reg linvpc lprice t

      Source |       SS       df       MS              Number of obs =      42
-------------+------------------------------           F(  2,    39) =   10.08
       Model |  .415945135     2  .207972568           Prob > F      =  0.0003
    Residual |  .804674809    39  .020632687           R-squared     =  0.3408
-------------+------------------------------           Adj R-squared =  0.3070
       Total |  1.22061994    41  .029771218           Root MSE      =  .14364

------------------------------------------------------------------------------
      linvpc |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      lprice |  -.3809609   .6788352    -0.56   0.578    -1.754035     .992113
           t |   .0098287   .0035122     2.80   0.008     .0027246    .0169328
       _cons |  -.9130595   .1356134    -6.73   0.000    -1.187363   -.6387556
------------------------------------------------------------------------------

Example 10.8: Fertility Equation

use http://fmwww.bc.edu/ec-p/data/wooldridge/fertil3
reg gfr pe ww2 pill t

      Source |       SS       df       MS              Number of obs =      72
-------------+------------------------------           F(  4,    67) =   32.84
       Model |  18441.2357     4  4610.30894           Prob > F      =  0.0000
    Residual |  9406.65967    67  140.397905           R-squared     =  0.6622
-------------+------------------------------           Adj R-squared =  0.6420
       Total |  27847.8954    71  392.223879           Root MSE      =  11.849

------------------------------------------------------------------------------
         gfr |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          pe |   .2788778   .0400199     6.97   0.000     .1989978    .3587578
         ww2 |  -35.59228   6.297377    -5.65   0.000     -48.1619   -23.02266
        pill |   .9974479    6.26163     0.16   0.874    -11.50082    13.49571
           t |  -1.149872   .1879038    -6.12   0.000    -1.524929   -.7748146
       _cons |   111.7694   3.357765    33.29   0.000     105.0673    118.4716
------------------------------------------------------------------------------
reg gfr pe ww2 pill t tsq

      Source |       SS       df       MS              Number of obs =      72
-------------+------------------------------           F(  5,    66) =   35.09
       Model |  20236.3981     5  4047.27961           Prob > F      =  0.0000
    Residual |  7611.49734    66  115.325717           R-squared     =  0.7267
-------------+------------------------------           Adj R-squared =  0.7060
       Total |  27847.8954    71  392.223879           Root MSE      =  10.739

------------------------------------------------------------------------------
         gfr |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          pe |   .3478126   .0402599     8.64   0.000     .2674311     .428194
         ww2 |  -35.88028   5.707921    -6.29   0.000    -47.27651   -24.48404
        pill |  -10.11972   6.336094    -1.60   0.115    -22.77014    2.530696
           t |  -2.531426   .3893863    -6.50   0.000    -3.308861   -1.753991
         tsq |   .0196126    .004971     3.95   0.000     .0096876    .0295377
       _cons |   124.0919   4.360738    28.46   0.000     115.3854    132.7984
------------------------------------------------------------------------------

Example 10.9: Puerto Rican Employment

use http://fmwww.bc.edu/ec-p/data/wooldridge/prminwge
reg lprepop lmincov lusgnp t

      Source |       SS       df       MS              Number of obs =      38
-------------+------------------------------           F(  3,    34) =   62.78
       Model |  .270947898     3  .090315966           Prob > F      =  0.0000
    Residual |  .048910453    34  .001438543           R-squared     =  0.8471
-------------+------------------------------           Adj R-squared =  0.8336
       Total |  .319858351    37   .00864482           Root MSE      =  .03793

------------------------------------------------------------------------------
     lprepop |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     lmincov |  -.1686946   .0442464    -3.81   0.001    -.2586142    -.078775
      lusgnp |   1.057349   .1766381     5.99   0.000     .6983776    1.416321
           t |  -.0323541   .0050228    -6.44   0.000    -.0425616   -.0221467
       _cons |  -8.696287   1.295773    -6.71   0.000    -11.32961    -6.06296
------------------------------------------------------------------------------
reg lprepop lmincov lusgnp

      Source |       SS       df       MS              Number of obs =      38
-------------+------------------------------           F(  2,    35) =   34.04
       Model |  .211258194     2  .105629097           Prob > F      =  0.0000
    Residual |  .108600157    35  .003102862           R-squared     =  0.6605
-------------+------------------------------           Adj R-squared =  0.6411
       Total |  .319858351    37   .00864482           Root MSE      =   .0557

------------------------------------------------------------------------------
     lprepop |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     lmincov |  -.1544433   .0649015    -2.38   0.023    -.2862003   -.0226863
      lusgnp |  -.0121899   .0885134    -0.14   0.891    -.1918817    .1675019
       _cons |  -1.054413   .7654066    -1.38   0.177    -2.608271    .4994452
------------------------------------------------------------------------------

Example 10.10: Housing Investment

use http://fmwww.bc.edu/ec-p/data/wooldridge/hseinv
reg linvpc t

      Source |       SS       df       MS              Number of obs =      42
-------------+------------------------------           F(  1,    40) =   20.19
       Model |  .409447014     1  .409447014           Prob > F      =  0.0001
    Residual |   .81117293    40  .020279323           R-squared     =  0.3354
-------------+------------------------------           Adj R-squared =  0.3188
       Total |  1.22061994    41  .029771218           Root MSE      =  .14241

------------------------------------------------------------------------------
      linvpc |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           t |   .0081459   .0018129     4.49   0.000     .0044819    .0118098
       _cons |  -.8412918    .044744   -18.80   0.000    -.9317228   -.7508608
------------------------------------------------------------------------------
predict linvpch, res
reg linvpch lprice t

      Source |       SS       df       MS              Number of obs =      42
-------------+------------------------------           F(  2,    39) =    0.16
       Model |  .006498121     2  .003249061           Prob > F      =  0.8548
    Residual |  .804674806    39  .020632687           R-squared     =  0.0080
-------------+------------------------------           Adj R-squared = -0.0429
       Total |  .811172927    41  .019784706           Root MSE      =  .14364

------------------------------------------------------------------------------
     linvpch |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      lprice |  -.3809609   .6788352    -0.56   0.578    -1.754035     .992113
           t |   .0016828   .0035122     0.48   0.635    -.0054213    .0087869
       _cons |  -.0717677   .1356134    -0.53   0.600    -.3460716    .2025362
------------------------------------------------------------------------------
reg linvpc lprice t

      Source |       SS       df       MS              Number of obs =      42
-------------+------------------------------           F(  2,    39) =   10.08
       Model |  .415945135     2  .207972568           Prob > F      =  0.0003
    Residual |  .804674809    39  .020632687           R-squared     =  0.3408
-------------+------------------------------           Adj R-squared =  0.3070
       Total |  1.22061994    41  .029771218           Root MSE      =  .14364

------------------------------------------------------------------------------
      linvpc |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      lprice |  -.3809609   .6788352    -0.56   0.578    -1.754035     .992113
           t |   .0098287   .0035122     2.80   0.008     .0027246    .0169328
       _cons |  -.9130595   .1356134    -6.73   0.000    -1.187363   -.6387556
------------------------------------------------------------------------------

Example 10.11: Effects of Antidumping Filings

use http://fmwww.bc.edu/ec-p/data/wooldridge/barium
reg lchnimp lchempi lgas lrtwex befile6 affile6 afdec6 feb mar apr may jun jul aug sep oct nov dec

      Source |       SS       df       MS              Number of obs =     131
-------------+------------------------------           F( 17,   113) =    3.71
       Model |  22.8083791    17  1.34166936           Prob > F      =  0.0000
    Residual |  40.8438726   113    .3614502           R-squared     =  0.3583
-------------+------------------------------           Adj R-squared =  0.2618
       Total |  63.6522517   130  .489632706           Root MSE      =  .60121

------------------------------------------------------------------------------
     lchnimp |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     lchempi |   3.265067   .4929297     6.62   0.000     2.288485     4.24165
        lgas |  -1.278206   1.389015    -0.92   0.359    -4.030094    1.473683
      lrtwex |   .6630341    .471303     1.41   0.162    -.2707021     1.59677
     befile6 |   .1397036   .2668075     0.52   0.602      -.38889    .6682973
     affile6 |   .0126343   .2786866     0.05   0.964    -.5394941    .5647627
      afdec6 |  -.5213008   .3019498    -1.73   0.087    -1.119518    .0769161
         feb |   -.417716   .3044432    -1.37   0.173    -1.020873    .1854408
         mar |   .0590529   .2647304     0.22   0.824    -.4654258    .5835316
         apr |  -.4514835   .2683861    -1.68   0.095    -.9832049    .0802378
         may |   .0333114   .2692426     0.12   0.902    -.5001067    .5667294
         jun |  -.2063286   .2692517    -0.77   0.445    -.7397648    .3271076
         jul |   .0038404   .2787666     0.01   0.989    -.5484466    .5561273
         aug |   -.157059   .2779935    -0.56   0.573    -.7078142    .3936962
         sep |  -.1341598   .2676556    -0.50   0.617    -.6644338    .3961142
         oct |    .051691   .2668511     0.19   0.847    -.4769892    .5803712
         nov |   -.246259   .2628271    -0.94   0.351    -.7669669    .2744489
         dec |   .1328415   .2714237     0.49   0.625    -.4048978    .6705809
       _cons |   16.78074    32.4288     0.52   0.606    -47.46656    81.02804
------------------------------------------------------------------------------
test feb mar apr may jun jul aug sep oct nov dec

 ( 1)  feb = 0.0
 ( 2)  mar = 0.0
 ( 3)  apr = 0.0
 ( 4)  may = 0.0
 ( 5)  jun = 0.0
 ( 6)  jul = 0.0
 ( 7)  aug = 0.0
 ( 8)  sep = 0.0
 ( 9)  oct = 0.0
 (10)  nov = 0.0
 (11)  dec = 0.0

       F( 11,   113) =    0.86
            Prob > F =    0.5852

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