INTRODUCTORY ECONOMETRICS – REPLICATING EXAMPLES

Chapter 18. Advanced Time Series Topics – Examples

-------------------------------------------------------------------------------------
      name:  SN
       log:  ~Wooldridge\intro-econx\iexample18.smcl
  log type:  smcl
 opened on:  21 Jan 2019, 15:10:39

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

. * CHAPTER 18 Advanced Time Series Topics
. * Computer Exercises (Examples)
. ******************** SETUP *********************

. *Example 18.1. Housing Investment and Residential Price Inflation
. u hseinv, clear
. tsset year
        time variable:  year, 1947 to 1988
                delta:  1 unit
. reg linvpc t
      Source |       SS           df       MS      Number of obs   =        42
-------------+----------------------------------   F(1, 40)        =     20.19
       Model |  .409446973         1  .409446973   Prob > F        =    0.0001
    Residual |  .811173061        40  .020279327   R-squared       =    0.3354
-------------+----------------------------------   Adj R-squared   =    0.3188
       Total |  1.22062003        41   .02977122   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 y, res
. g y1 = y[_n-1]
(1 missing value generated)
. g gprice_1 = gprice[_n-1] 
(2 missing values generated)
. eststo GeometricDL: qui reg y gprice y1 
. eststo RationalDL: qui reg y gprice y1 gprice_1
. estout, cells(b(nostar fmt(3)) se(par fmt(3))) stats(N r2_a, fmt(%5.0g) labels(Smaple-///
size Adjusted-R-squared)) varlabels(_cons constant) varwidth(18) ti("Table 18.1 ///
Distributed Lag Models for Housing Investment: log(invpc)")
Table 18.1 Distributed Lag Models for Housing Investment: log(invpc)
--------------------------------------------
                    GeometricDL   RationalDL
                           b/se         b/se
--------------------------------------------
gprice                    3.095        3.256
                        (0.933)      (0.970)
y1                        0.340        0.547
                        (0.132)      (0.152)
gprice_1                              -2.936
                                     (0.973)
constant                 -0.010        0.006
                        (0.018)      (0.017)
--------------------------------------------
Smaple-size                  41           40
Adjusted-R-squared         .375         .504
--------------------------------------------
. est clear

. *Example 18.2. Unit Root Test for Three-Month T-Bill Rates
. u intqrt, clear
. reg cr3 r3_1
      Source |       SS           df       MS      Number of obs   =       123
-------------+----------------------------------   F(1, 121)       =      6.12
       Model |  9.22556542         1  9.22556542   Prob > F        =    0.0148
    Residual |  182.506035       121  1.50831434   R-squared       =    0.0481
-------------+----------------------------------   Adj R-squared   =    0.0403
       Total |    191.7316       122   1.5715705   Root MSE        =    1.2281
------------------------------------------------------------------------------
         cr3 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        r3_1 |  -.0907106   .0366782    -2.47   0.015    -.1633247   -.0180965
       _cons |   .6253371   .2608254     2.40   0.018     .1089645     1.14171
------------------------------------------------------------------------------
. display "roh = " 1 + _b[r3_1]
roh = .90928938
. di "t statistics on r3_1 = " _b[r3_1]/_se[r3_1]
t statistics on r3_1 = -2.4731506
. reg r3 r3_1
      Source |       SS           df       MS      Number of obs   =       123
-------------+----------------------------------   F(1, 121)       =    614.60
       Model |  927.002641         1  927.002641   Prob > F        =    0.0000
    Residual |  182.506035       121  1.50831434   R-squared       =    0.8355
-------------+----------------------------------   Adj R-squared   =    0.8341
       Total |  1109.50868       122  9.09433341   Root MSE        =    1.2281
------------------------------------------------------------------------------
          r3 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        r3_1 |   .9092894   .0366782    24.79   0.000     .8366753    .9819035
       _cons |   .6253371   .2608254     2.40   0.018     .1089645     1.14171
------------------------------------------------------------------------------

. *Example 18.3. Unit Root Test for Annual U.S. Inflation
. u phillips, clear
. reg cinf inf_1 cinf_1
      Source |       SS           df       MS      Number of obs   =        47
-------------+----------------------------------   F(2, 44)        =      4.57
       Model |  38.4043273         2  19.2021636   Prob > F        =    0.0158
    Residual |   184.96036        44  4.20364454   R-squared       =    0.1719
-------------+----------------------------------   Adj R-squared   =    0.1343
       Total |  223.364687        46  4.85575407   Root MSE        =    2.0503
------------------------------------------------------------------------------
        cinf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       inf_1 |  -.3103252   .1027077    -3.02   0.004     -.517319   -.1033315
      cinf_1 |   .1383615   .1264026     1.09   0.280    -.1163861    .3931091
       _cons |   1.360791   .5167103     2.63   0.012     .3194297    2.402152
------------------------------------------------------------------------------
. di "roh = " 1 + _b[inf_1]
roh = .68967477
. reg cinf inf_1
      Source |       SS           df       MS      Number of obs   =        48
-------------+----------------------------------   F(1, 46)        =      9.79
       Model |  54.3454788         1  54.3454788   Prob > F        =    0.0030
    Residual |  255.342656        46  5.55092731   R-squared       =    0.1755
-------------+----------------------------------   Adj R-squared   =    0.1576
       Total |  309.688135        47  6.58910925   Root MSE        =     2.356
------------------------------------------------------------------------------
        cinf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       inf_1 |  -.3347414   .1069819    -3.13   0.003    -.5500849   -.1193979
       _cons |    1.27665   .5576568     2.29   0.027     .1541456    2.399155
------------------------------------------------------------------------------
. di "roh2 = " 1 + _b[inf_1]
roh2 = .66525859

. *Example 18.4. Unit Root in the Log of U.S. Real Gross Domestic Product
. u inven, clear
. g lgdp_1 = ln(gdp[_n-1])
(1 missing value generated)
. g ggdp_1 = ggdp[_n-1]
(2 missing values generated)
. egen t=seq()
. reg ggdp t lgdp_1 ggdp_1 
      Source |       SS           df       MS      Number of obs   =        35
-------------+----------------------------------   F(3, 31)        =      3.78
       Model |  .004591904         3  .001530635   Prob > F        =    0.0201
    Residual |  .012541759        31  .000404573   R-squared       =    0.2680
-------------+----------------------------------   Adj R-squared   =    0.1972
       Total |  .017133663        34  .000503931   Root MSE        =    .02011
------------------------------------------------------------------------------
        ggdp |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           t |   .0058696    .002696     2.18   0.037     .0003712    .0113681
      lgdp_1 |  -.2096209    .086594    -2.42   0.022    -.3862305   -.0330113
      ggdp_1 |   .2637508   .1647395     1.60   0.120    -.0722377    .5997392
       _cons |   1.650923   .6663996     2.48   0.019     .2917916    3.010054
------------------------------------------------------------------------------
. di "roh = " 1 + _b[lgdp_1]
roh = .79037908
. reg ggdp lgdp_1 ggdp_1 
      Source |       SS           df       MS      Number of obs   =        35
-------------+----------------------------------   F(2, 32)        =      2.96
       Model |  .002674172         2  .001337086   Prob > F        =    0.0662
    Residual |  .014459491        32  .000451859   R-squared       =    0.1561
-------------+----------------------------------   Adj R-squared   =    0.1033
       Total |  .017133663        34  .000503931   Root MSE        =    .02126
------------------------------------------------------------------------------
        ggdp |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      lgdp_1 |  -.0226875   .0118894    -1.91   0.065    -.0469055    .0015304
      ggdp_1 |   .1671607   .1676688     1.00   0.326    -.1743696    .5086909
       _cons |   .2148857   .1004679     2.14   0.040     .0102392    .4195321
------------------------------------------------------------------------------
. di "roh = " 1 + _b[lgdp_1]
roh = .97731246

. *Example 18.5. Cointegration between Fertility and Personal Exemption
. u fertil3, clear
. tsset t
        time variable:  t, 1 to 72
                delta:  1 unit
. reg gfr t pe 
      Source |       SS           df       MS      Number of obs   =        72
-------------+----------------------------------   F(2, 69)        =     34.53
       Model |  13929.0853         2  6964.54264   Prob > F        =    0.0000
    Residual |  13918.8101        69  201.721886   R-squared       =    0.5002
-------------+----------------------------------   Adj R-squared   =    0.4857
       Total |  27847.8954        71  392.223879   Root MSE        =    14.203
------------------------------------------------------------------------------
         gfr |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           t |  -.9051881   .1089923    -8.31   0.000    -1.122622   -.6877543
          pe |    .186662   .0346265     5.39   0.000     .1175841    .2557399
       _cons |   109.9302    3.47526    31.63   0.000     102.9972    116.8631
------------------------------------------------------------------------------
. predict u, res
. //regression in levels
. reg cgfr cpe 

      Source |       SS           df       MS      Number of obs   =        71
-------------+----------------------------------   F(1, 69)        =      2.26
       Model |  40.3237206         1  40.3237206   Prob > F        =    0.1370
    Residual |  1229.25866        69  17.8153428   R-squared       =    0.0318
-------------+----------------------------------   Adj R-squared   =    0.0177
       Total |  1269.58238        70  18.1368911   Root MSE        =    4.2208

------------------------------------------------------------------------------
        cgfr |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         cpe |  -.0426776   .0283672    -1.50   0.137    -.0992686    .0139134
       _cons |  -.7847796   .5020398    -1.56   0.123    -1.786322    .2167625
------------------------------------------------------------------------------
. // Augmented DF test for gfr & pe
. dfuller gfr, lags(1) trend
Augmented Dickey-Fuller test for unit root         Number of obs   =        70

                               ---------- Interpolated Dickey-Fuller ---------
                  Test         1% Critical       5% Critical      10% Critical
               Statistic           Value             Value             Value
------------------------------------------------------------------------------
 Z(t)             -1.474            -4.106            -3.480            -3.168
------------------------------------------------------------------------------
MacKinnon approximate p-value for Z(t) = 0.8378
. dfuller pe,  lags(1) trend
Augmented Dickey-Fuller test for unit root         Number of obs   =        70

                               ---------- Interpolated Dickey-Fuller ---------
                  Test         1% Critical       5% Critical      10% Critical
               Statistic           Value             Value             Value
------------------------------------------------------------------------------
 Z(t)             -1.471            -4.106            -3.480            -3.168
------------------------------------------------------------------------------
MacKinnon approximate p-value for Z(t) = 0.8388
. //Regression in levels with a single lag & time trend, manually
. gen u_1=u[_n-1]
(1 missing value generated)
. gen cu = u - u_1
(1 missing value generated)
. gen cu_1 = cu[_n-1]
(2 missing values generated)
. reg cu u_1 cu_1 t
      Source |       SS           df       MS      Number of obs   =        70
-------------+----------------------------------   F(3, 66)        =      3.07
       Model |  291.902357         3  97.3007857   Prob > F        =    0.0338
    Residual |  2092.94085        66   31.711225   R-squared       =    0.1224
-------------+----------------------------------   Adj R-squared   =    0.0825
       Total |  2384.84321        69   34.562945   Root MSE        =    5.6313
------------------------------------------------------------------------------
          cu |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         u_1 |  -.1188282   .0490884    -2.42   0.018    -.2168364   -.0208201
        cu_1 |   .2378983   .1176739     2.02   0.047     .0029547    .4728418
           t |   .0257499   .0334197     0.77   0.444    -.0409748    .0924746
       _cons |  -1.150008   1.424272    -0.81   0.422    -3.993659    1.693644
------------------------------------------------------------------------------
. //Test alternativelly using the augumented DF command in Stata
. dfuller u, lags(1) trend reg
Augmented Dickey-Fuller test for unit root         Number of obs   =        70

                               ---------- Interpolated Dickey-Fuller ---------
                  Test         1% Critical       5% Critical      10% Critical
               Statistic           Value             Value             Value
------------------------------------------------------------------------------
 Z(t)             -2.421            -4.106            -3.480            -3.168
------------------------------------------------------------------------------
MacKinnon approximate p-value for Z(t) = 0.3687
------------------------------------------------------------------------------
D.u          |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           u |
         L1. |  -.1188282   .0490884    -2.42   0.018    -.2168364   -.0208201
         LD. |   .2378983   .1176739     2.02   0.047     .0029547    .4728418
      _trend |   .0257499   .0334197     0.77   0.444    -.0409748    .0924746
       _cons |  -1.124258   1.394914    -0.81   0.423    -3.909294    1.660778
------------------------------------------------------------------------------
. // First difference regression, with two lags (equation 11.27)
. reg cgfr cpe cpe_1 cpe_2
      Source |       SS           df       MS      Number of obs   =        69
-------------+----------------------------------   F(3, 65)        =      6.56
       Model |  293.259859         3  97.7532864   Prob > F        =    0.0006
    Residual |  968.199959        65   14.895384   R-squared       =    0.2325
-------------+----------------------------------   Adj R-squared   =    0.1971
       Total |  1261.45982        68  18.5508797   Root MSE        =    3.8595
------------------------------------------------------------------------------
        cgfr |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         cpe |  -.0362021   .0267737    -1.35   0.181     -.089673    .0172687
       cpe_1 |  -.0139706   .0275539    -0.51   0.614    -.0689997    .0410584
       cpe_2 |   .1099896   .0268797     4.09   0.000     .0563071    .1636721
       _cons |  -.9636787   .4677599    -2.06   0.043     -1.89786   -.0294976
------------------------------------------------------------------------------

. *Example 18.6. Cointegrating Parameter for Interest Rates
. u intqrt, clear
. g cr3_2=cr3[_n-2]
(3 missing values generated)
. g cr3_a=cr3[_n+1]
(1 missing value generated)
. g cr3_b=cr3[_n+2]
(2 missing values generated)
. reg r6 r3 cr3 cr3_1 cr3_2 cr3_a cr3_b
      Source |       SS           df       MS      Number of obs   =       119
-------------+----------------------------------   F(6, 112)       =   3176.06
       Model |  1148.95762         6  191.492937   Prob > F        =    0.0000
    Residual |  6.75277093       112  .060292598   R-squared       =    0.9942
-------------+----------------------------------   Adj R-squared   =    0.9938
       Total |  1155.71039       118  9.79415587   Root MSE        =    .24555
------------------------------------------------------------------------------
          r6 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          r3 |   1.038171   .0080773   128.53   0.000     1.022167    1.054175
         cr3 |  -.0531227   .0194406    -2.73   0.007    -.0916418   -.0146036
       cr3_1 |  -.0611365   .0190433    -3.21   0.002    -.0988684   -.0234046
       cr3_2 |  -.0437775   .0189032    -2.32   0.022    -.0812318   -.0063233
       cr3_a |  -.0035722   .0191223    -0.19   0.852    -.0414606    .0343163
       cr3_b |   .0123662   .0189704     0.65   0.516    -.0252213    .0499536
       _cons |   .0651458   .0569524     1.14   0.255     -.047698    .1779895
------------------------------------------------------------------------------
. *test Ho: B=1
. di (_b[r3]-1)/_se[r3]
4.7256731
. *Test serial correlation
. predict u, res
(5 missing values generated)
. g u_1 = u[_n-1]
(5 missing values generated)
. reg r6 r3 cr3 cr3_1 cr3_2 cr3_a cr3_b u_1
      Source |       SS           df       MS      Number of obs   =       118
-------------+----------------------------------   F(7, 110)       =   2692.36
       Model |  1144.45133         7  163.493048   Prob > F        =    0.0000
    Residual |  6.67973808       110  .060724892   R-squared       =    0.9942
-------------+----------------------------------   Adj R-squared   =    0.9938
       Total |  1151.13107       117  9.83872711   Root MSE        =    .24642
------------------------------------------------------------------------------
          r6 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          r3 |   1.037809    .008159   127.20   0.000      1.02164    1.053979
         cr3 |  -.0529965   .0195394    -2.71   0.008     -.091719    -.014274
       cr3_1 |  -.0604062    .019224    -3.14   0.002    -.0985036   -.0223088
       cr3_2 |  -.0438142   .0189911    -2.31   0.023    -.0814501   -.0061783
       cr3_a |  -.0038517   .0192129    -0.20   0.841    -.0419272    .0342237
       cr3_b |   .0104361   .0192032     0.54   0.588    -.0276201    .0484922
         u_1 |   .1039441   .0961908     1.08   0.282    -.0866835    .2945718
       _cons |   .0675986   .0577105     1.17   0.244    -.0467701    .1819673
------------------------------------------------------------------------------
. reg u u_1
      Source |       SS           df       MS      Number of obs   =       118
-------------+----------------------------------   F(1, 116)       =      1.22
       Model |  .070280124         1  .070280124   Prob > F        =    0.2716
    Residual |  6.68042825       116  .057589899   R-squared       =    0.0104
-------------+----------------------------------   Adj R-squared   =    0.0019
       Total |  6.75070837       117  .057698362   Root MSE        =    .23998
------------------------------------------------------------------------------
           u |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         u_1 |   .1031829   .0934039     1.10   0.272    -.0818152    .2881811
       _cons |   .0000442    .022094     0.00   0.998    -.0437158    .0438041
------------------------------------------------------------------------------
. *Compare with Simple OLS
. reg r6 r3
      Source |       SS           df       MS      Number of obs   =       124
-------------+----------------------------------   F(1, 122)       =  17710.54
       Model |  1182.09126         1  1182.09126   Prob > F        =    0.0000
    Residual |  8.14289673       122  .066745055   R-squared       =    0.9932
-------------+----------------------------------   Adj R-squared   =    0.9931
       Total |  1190.23416       123   9.6767005   Root MSE        =    .25835
------------------------------------------------------------------------------
          r6 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          r3 |   1.025899   .0077088   133.08   0.000     1.010639     1.04116
       _cons |   .1353736   .0548673     2.47   0.015     .0267584    .2439889
------------------------------------------------------------------------------

. *Example 18.7. Error Correction Model for Holding Yields
. u intqrt, clear
. g hy3_2=hy3[_n-2]
(2 missing values generated)
. g hy6_1hy3_2= hy6_1 - hy3_2
(2 missing values generated)
. reg chy6 chy3_1 hy6_1hy3_2
      Source |       SS           df       MS      Number of obs   =       122
-------------+----------------------------------   F(2, 119)       =    223.79
       Model |  51.8888369         2  25.9444184   Prob > F        =    0.0000
    Residual |   13.795981       119  .115932613   R-squared       =    0.7900
-------------+----------------------------------   Adj R-squared   =    0.7864
       Total |  65.6848179       121  .542849734   Root MSE        =    .34049
------------------------------------------------------------------------------
        chy6 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      chy3_1 |   1.218364   .2636012     4.62   0.000     .6964078    1.740321
  hy6_1hy3_2 |  -.8400485   .2441269    -3.44   0.001    -1.323444   -.3566528
       _cons |   .0898483    .042688     2.10   0.037     .0053217    .1743748
------------------------------------------------------------------------------

. *Example 18.8. Forecasting the U.S. Unemployment Rate
. u phillips, clear
. reg unem unem_1
      Source |       SS           df       MS      Number of obs   =        48
-------------+----------------------------------   F(1, 46)        =     57.13
       Model |  62.8162728         1  62.8162728   Prob > F        =    0.0000
    Residual |  50.5768515        46  1.09949677   R-squared       =    0.5540
-------------+----------------------------------   Adj R-squared   =    0.5443
       Total |  113.393124        47  2.41261967   Root MSE        =    1.0486
------------------------------------------------------------------------------
        unem |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      unem_1 |   .7323538   .0968906     7.56   0.000      .537323    .9273845
       _cons |   1.571741   .5771181     2.72   0.009     .4100629     2.73342
------------------------------------------------------------------------------
. di "Forcasts of unem for 1997 =" %6.3f _b[_cons] + _b[unem_1]*5.4 
Forcasts of unem for 1997 = 5.526
. reg unem unem_1 inf_1
      Source |       SS           df       MS      Number of obs   =        48
-------------+----------------------------------   F(2, 45)        =     50.22
       Model |  78.3083336         2  39.1541668   Prob > F        =    0.0000
    Residual |  35.0847907        45  .779662015   R-squared       =    0.6906
-------------+----------------------------------   Adj R-squared   =    0.6768
       Total |  113.393124        47  2.41261967   Root MSE        =    .88298
------------------------------------------------------------------------------
        unem |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      unem_1 |   .6470261   .0838056     7.72   0.000     .4782329    .8158192
       inf_1 |   .1835766   .0411828     4.46   0.000     .1006302    .2665231
       _cons |   1.303797   .4896861     2.66   0.011     .3175188    2.290076
------------------------------------------------------------------------------
. di "Forcasts of unem for 1997 =" %6.3f _b[_cons] + _b[unem_1]*5.4 + _b[inf_1]*3
Forcasts of unem for 1997 = 5.348
. *95% forecast interval
. g unem_1f = unem_1 - 5.4
(1 missing value generated)
. g inf_1f = inf_1 - 3
(1 missing value generated)
. reg unem unem_1f inf_1f
      Source |       SS           df       MS      Number of obs   =        48
-------------+----------------------------------   F(2, 45)        =     50.22
       Model |  78.3083334         2  39.1541667   Prob > F        =    0.0000
    Residual |  35.0847909        45  .779662019   R-squared       =    0.6906
-------------+----------------------------------   Adj R-squared   =    0.6768
       Total |  113.393124        47  2.41261967   Root MSE        =    .88298
------------------------------------------------------------------------------
        unem |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     unem_1f |   .6470261   .0838056     7.72   0.000     .4782329    .8158192
      inf_1f |   .1835766   .0411828     4.46   0.000     .1006302    .2665231
       _cons |   5.348468   .1365394    39.17   0.000     5.073463    5.623472
------------------------------------------------------------------------------
. di "Forcast = "%5.3f _b[_cons] ", SE = " %5.3f _se[_cons] " & se(e+1) = " %5.3f ///
 [_se[_cons]^2 + e(rmse)^2]^0.5
Forcast = 5.348, SE = 0.137 & se(e+1) = 0.893
. di "The 95% forcast interval is " "[" %6.3f _b[_cons] - 1.96 * [_se[_cons]^2 + ///
 e(rmse)^2]^0.5 " , "%6.3f _b[_cons] + 1.96 * [_se[_cons]^2 + e(rmse)^2]^0.5 "]"
The 95% forcast interval is [ 3.597 ,  7.100]

. *Example 18.9. Out-of-Sample Comparisons of Unemployment Forecasts
. u phillips, clear
. qui reg unem unem_1 
. di "RMSE = " %5.3f e(rmse)
RMSE = 1.049
. predict u, res
(1 missing value generated)
. g ua=abs(u)
(1 missing value generated)
. sum ua
    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
          ua |         48    .8129182     .633409   .0967489   2.827077
. di "MSE = " %5.3f r(mean)
MSE = 0.813
. qui reg unem unem_1 inf_1 
. di "RMSE = " %5.3f e(rmse)
RMSE = 0.883
. predict uinf, res
(1 missing value generated)
. g uinfa=abs(uinf)
(1 missing value generated)
. sum uinfa
    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
       uinfa |         48    .6493123     .562057   .0124001   2.172966
. di "MSE = " %5.3f r(mean)
MSE = 0.649

. *Example 18.10. Two-Year-Ahead Forecast for the Unemployment Rate
. u phillips, clear
. reg inf inf_1 unem_1, nohead
------------------------------------------------------------------------------
         inf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       inf_1 |   .6588309   .1110218     5.93   0.000     .4352214    .8824404
      unem_1 |    .057266   .2259257     0.25   0.801    -.3977716    .5123036
       _cons |   .9740445    1.32011     0.74   0.464    -1.684794    3.632883
------------------------------------------------------------------------------
. reg inf inf_1
      Source |       SS           df       MS      Number of obs   =        48
-------------+----------------------------------   F(1, 46)        =     38.67
       Model |  214.647351         1  214.647351   Prob > F        =    0.0000
    Residual |  255.342659        46  5.55092736   R-squared       =    0.4567
-------------+----------------------------------   Adj R-squared   =    0.4449
       Total |   469.99001        47  9.99978744   Root MSE        =     2.356
------------------------------------------------------------------------------
         inf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       inf_1 |   .6652586   .1069819     6.22   0.000     .4499151    .8806021
       _cons |    1.27665   .5576568     2.29   0.027     .1541456    2.399155
------------------------------------------------------------------------------
. qui {
g inf_96=inf if year==1996
g inf_97= _b[_cons] + _b[inf]*inf_96
sum inf_97
} 
. di "Inf_97 = " %5.2f r(mean)
Inf_97 =  3.27
. qui {
reg unem unem_1 inf_1
g unem_96 = unem if year==1996
g unem_97 = _b[_cons] + _b[unem_1]*unem_96 + _b[inf]*inf_96
g unem_98 = _b[_cons] + _b[unem_1]*unem_97 + _b[inf]*inf_97
sum unem_98
}
. di "unem_98 = " %5.2f  r(mean)
unem_98 =  5.37

. log close
      name:  SN
       log:  ~Wooldridge\intro-econx\iexample16.smcl
  log type:  smcl
 closed on:  21 Jan 2019, 15:10:41
-------------------------------------------------------------------------------------




0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *