Example 18.1: Housing Investment and Residential Price Inflation
use http://fmwww.bc.edu/ec-p/data/wooldridge/hseinv
tsset year
time variable: year, 1947 to 1988
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 elinvpc,r
reg elinvpc gprice L.elinvpc
Source | SS df MS Number of obs = 41
-------------+------------------------------ F( 2, 38) = 13.02
Model | .322534831 2 .161267415 Prob > F = 0.0000
Residual | .470603501 38 .012384303 R-squared = 0.4067
-------------+------------------------------ Adj R-squared = 0.3754
Total | .793138332 40 .019828458 Root MSE = .11128
------------------------------------------------------------------------------
elinvpc | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
gprice | 3.094828 .9333266 3.32 0.002 1.205407 4.984249
elinvpc |
L1 | .3399015 .1315881 2.58 0.014 .0735154 .6062876
_cons | -.0099629 .017916 -0.56 0.581 -.046232 .0263061
------------------------------------------------------------------------------
scalar lrpGDL = _b[gprice]/(1-_b[L.elinvpc])
display _n "long run propensity : " lrpGDL
long run propensity : 4.6884339
reg elinvpc gprice L.elinvpc L.gprice
Source | SS df MS Number of obs = 40
-------------+------------------------------ F( 3, 36) = 14.20
Model | .429863193 3 .143287731 Prob > F = 0.0000
Residual | .3632598 36 .01009055 R-squared = 0.5420
-------------+------------------------------ Adj R-squared = 0.5038
Total | .793122992 39 .020336487 Root MSE = .10045
------------------------------------------------------------------------------
elinvpc | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
gprice | 3.256352 .9703223 3.36 0.002 1.288447 5.224257
elinvpc |
L1 | .5471706 .1516713 3.61 0.001 .2395669 .8547743
gprice |
L1 | -2.936344 .9731857 -3.02 0.005 -4.910056 -.9626315
_cons | .0058685 .0169326 0.35 0.731 -.0284725 .0402095
------------------------------------------------------------------------------
scalar lrpRDL = (_b[gprice]+_b[L.gprice])/(1-_b[L.elinvpc])
display _n "long run propensity : " lrpRDL
long run propensity : .70668588
Example 18.2: Unit Root Test for Three-Month T-Bill Rates
use http://fmwww.bc.edu/ec-p/data/wooldridge/intqrt
reg cr3 r3_1
Source | SS df MS Number of obs = 123
-------------+------------------------------ F( 1, 121) = 6.12
Model | 9.22556712 1 9.22556712 Prob > F = 0.0148
Residual | 182.506041 121 1.50831439 R-squared = 0.0481
-------------+------------------------------ Adj R-squared = 0.0403
Total | 191.731608 122 1.57157056 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 "rho=" 1+_b[r3_1]
rho=.90928937
Example 18.3: Unit Root Test for Annual U.S. Inflation
use http://fmwww.bc.edu/ec-p/data/wooldridge/phillips
reg cinf inf_1 cinf_1
Source | SS df MS Number of obs = 47
-------------+------------------------------ F( 2, 44) = 4.57
Model | 38.4043268 2 19.2021634 Prob > F = 0.0158
Residual | 184.960355 44 4.20364442 R-squared = 0.1719
-------------+------------------------------ Adj R-squared = 0.1343
Total | 223.364681 46 4.85575395 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 .1264025 1.09 0.280 -.1163861 .3931091
_cons | 1.360791 .5167103 2.63 0.012 .3194297 2.402152
------------------------------------------------------------------------------
display "rho=" 1+_b[inf_1]
rho=.68967477
Example 18.4: Unit Root in the Log of U.S. Real Gross Domestic Product
use http://fmwww.bc.edu/ec-p/data/wooldridge/inven
tsset year
time variable: year, 1959 to 1995
gen lgdp=log(gdp)
reg D.lgdp year L.lgdp L.D.lgdp
Source | SS df MS Number of obs = 35
-------------+------------------------------ F( 3, 31) = 3.78
Model | .004591884 3 .001530628 Prob > F = 0.0201
Residual | .012541804 31 .000404574 R-squared = 0.2680
-------------+------------------------------ Adj R-squared = 0.1972
Total | .017133688 34 .000503932 Root MSE = .02011
------------------------------------------------------------------------------
D.lgdp | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
year | .0058696 .002696 2.18 0.037 .0003711 .0113681
lgdp |
L1 | -.2096203 .0865941 -2.42 0.022 -.3862301 -.0330104
LD | .2637479 .1647397 1.60 0.120 -.0722409 .5997367
_cons | -9.841804 4.620125 -2.13 0.041 -19.26461 -.4189969
------------------------------------------------------------------------------
display "rho=" 1+_b[L.lgdp]
rho=.79037972
reg D.lgdp L.lgdp L.D.lgdp
Source | SS df MS Number of obs = 35
-------------+------------------------------ F( 2, 32) = 2.96
Model | .002674165 2 .001337083 Prob > F = 0.0662
Residual | .014459523 32 .00045186 R-squared = 0.1561
-------------+------------------------------ Adj R-squared = 0.1033
Total | .017133688 34 .000503932 Root MSE = .02126
------------------------------------------------------------------------------
D.lgdp | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
lgdp |
L1 | -.0226876 .0118894 -1.91 0.065 -.0469056 .0015304
LD | .1671587 .167669 1.00 0.326 -.1743718 .5086892
_cons | .2148862 .100468 2.14 0.040 .0102395 .4195328
------------------------------------------------------------------------------
display "rho=" 1+_b[L.lgdp]
rho=.9773124
Example 18.5: Cointegration Between Fertility and Personal Exemption
use http://fmwww.bc.edu/ec-p/data/wooldridge/fertil3
tsset year
time variable: year, 1913 to 1984
reg gfr pe year
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]
-------------+----------------------------------------------------------------
pe | .186662 .0346265 5.39 0.000 .1175841 .2557399
year | -.9051881 .1089923 -8.31 0.000 -1.122622 -.6877543
_cons | 1840.65 210.0516 8.76 0.000 1421.608 2259.691
------------------------------------------------------------------------------
predict uh, res
reg D.gfr D.pe year
Source | SS df MS Number of obs = 71
-------------+------------------------------ F( 2, 68) = 1.16
Model | 42.0144941 2 21.0072471 Prob > F = 0.3185
Residual | 1227.56788 68 18.0524688 R-squared = 0.0331
-------------+------------------------------ Adj R-squared = 0.0047
Total | 1269.58238 70 18.1368911 Root MSE = 4.2488
------------------------------------------------------------------------------
D.gfr | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
pe |
D1 | -.0441285 .0289463 -1.52 0.132 -.1018899 .0136329
year | -.007633 .0249413 -0.31 0.761 -.0574026 .0421367
_cons | 14.09361 48.61889 0.29 0.773 -82.92387 111.1111
------------------------------------------------------------------------------
reg D.gfr L.gfr L.D.gfr year
Source | SS df MS Number of obs = 70
-------------+------------------------------ F( 3, 66) = 2.77
Model | 141.284323 3 47.0947745 Prob > F = 0.0482
Residual | 1120.70979 66 16.9804513 R-squared = 0.1120
-------------+------------------------------ Adj R-squared = 0.0716
Total | 1261.99411 69 18.2897697 Root MSE = 4.1207
------------------------------------------------------------------------------
D.gfr | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
gfr |
L1 | -.0438938 .0297773 -1.47 0.145 -.1033461 .0155585
LD | .3092968 .1166811 2.65 0.010 .0763355 .5422581
year | -.0185421 .0282515 -0.66 0.514 -.074948 .0378638
_cons | 39.73213 56.5777 0.70 0.485 -73.22889 152.6931
------------------------------------------------------------------------------
reg D.pe L.pe L.D.pe year
Source | SS df MS Number of obs = 70
-------------+------------------------------ F( 3, 66) = 2.49
Model | 2254.87222 3 751.624073 Prob > F = 0.0675
Residual | 19882.889 66 301.255894 R-squared = 0.1019
-------------+------------------------------ Adj R-squared = 0.0610
Total | 22137.7612 69 320.837119 Root MSE = 17.357
------------------------------------------------------------------------------
D.pe | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
pe |
L1 | -.0661281 .0449466 -1.47 0.146 -.1558668 .0236106
LD | .2567035 .1220926 2.10 0.039 .0129377 .5004694
year | .0316731 .1463908 0.22 0.829 -.2606056 .3239517
_cons | -54.13747 282.2287 -0.19 0.848 -617.6253 509.3503
------------------------------------------------------------------------------
reg D.uh L.uh L.D.uh year
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
------------------------------------------------------------------------------
D.uh | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
uh |
L1 | -.1188282 .0490884 -2.42 0.018 -.2168364 -.0208201
LD | .2378983 .1176739 2.02 0.047 .0029547 .4728418
year | .0257499 .0334197 0.77 0.444 -.0409748 .0924746
_cons | -50.38379 65.15702 -0.77 0.442 -180.474 79.7064
------------------------------------------------------------------------------
Example 18.6: Cointegrated Parameter for Interest Rates
use http://fmwww.bc.edu/ec-p/data/wooldridge/intqrt
gen cr3_2 = cr3[_n-2]
gen cr3_1p = cr3[_n+1]
gen cr3_2p = cr3[_n+2]
reg r6 r3 cr3 cr3_1 cr3_2 cr3_1p cr3_2p
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.75277085 112 .060292597 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_1p | -.0035722 .0191223 -0.19 0.852 -.0414606 .0343163
cr3_2p | .0123662 .0189704 0.65 0.516 -.0252213 .0499536
_cons | .0651458 .0569524 1.14 0.255 -.047698 .1779895
------------------------------------------------------------------------------
test r3
( 1) r3 = 0.0
F( 1, 112) =16519.67
Prob > F = 0.0000
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
use http://fmwww.bc.edu/ec-p/data/wooldridge/intqrt
gen del = hy6_1 - hy3[_n-2]
reg chy6 chy3_1 del
Source | SS df MS Number of obs = 122
-------------+------------------------------ F( 2, 119) = 223.79
Model | 51.8888367 2 25.9444184 Prob > F = 0.0000
Residual | 13.7959796 119 .115932602 R-squared = 0.7900
-------------+------------------------------ Adj R-squared = 0.7864
Total | 65.6848163 121 .542849722 Root MSE = .34049
------------------------------------------------------------------------------
chy6 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
chy3_1 | 1.218363 .2636012 4.62 0.000 .6964068 1.74032
del | -.8400495 .2441269 -3.44 0.001 -1.323445 -.3566539
_cons | .0898484 .042688 2.10 0.037 .0053219 .174375
------------------------------------------------------------------------------
Example 18.8: Forecasting the U.S. Unemployment Rate
use http://fmwww.bc.edu/ec-p/data/wooldridge/phillips
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 .5373231 .9273845
_cons | 1.571741 .5771181 2.72 0.009 .4100629 2.73342
------------------------------------------------------------------------------
display "Forecast for 1997: " _b[_cons] +_b[unem_1]*5.4
Forecasts for 1997: 5.5264519
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
------------------------------------------------------------------------------
display "Forecast for 1997: " _b[_cons] +_b[unem_1]*5.4 +_b[ inf_1]*3
Forecasts for 1997: 5.3484678
gen un1 = unem_1-5.4
gen inf1 = inf_1-3
reg unem un1 inf1
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]
-------------+----------------------------------------------------------------
un1 | .6470261 .0838056 7.72 0.000 .4782329 .8158192
inf1 | .1835766 .0411828 4.46 0.000 .1006302 .2665231
_cons | 5.348468 .1365394 39.17 0.000 5.073463 5.623472
------------------------------------------------------------------------------
scalar down = _b[ _cons]-1.96*sqrt(_se[_cons]^2+e(rmse)^2)
scalar up= _b[_cons]+1.96*sqrt(_se[_cons]^2+e(rmse)^2)
display "95% forecast interval: [" down ","up "]"
95% forecast interval: [3.5972486,7.099687]
Example 18.9: Out-of -Sample Comparison of Unemployment Forecasts
use http://fmwww.bc.edu/ec-p/data/wooldridge/phillips
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 .5373231 .9273845
_cons | 1.571741 .5771181 2.72 0.009 .4100629 2.73342
------------------------------------------------------------------------------
display _n "RMSE : " %9.3f e(rmse)
RMSE : 1.049
qui {
predict eps1 if e(sample), r
replace eps1 = abs(eps)
summ eps1,meanonly
}
display _n "MAE : " %9.3f `r(mean)'
MAE : 0.813
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
------------------------------------------------------------------------------
display _n "RMSE : " %9.3f e(rmse)
RMSE : 0.883
qui {
predict eps if e(sample), r
replace eps = abs(eps)
summ eps,meanonly
}
display _n "MAE : " %9.3f `r(mean)'
MAE : 0.649
Example 18.10: Two-Year-Ahead Forecast for the Unemployment Rate
use http://fmwww.bc.edu/ec-p/data/wooldridge/phillips
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
-----------------------------------------------------------------------------
scalar inf1997 = _b[_cons]+_b[inf_1]*3
display "Forecast for inflation in 1997: " inf1997
Forecast for inflation in 1997: 3.2724262
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
------------------------------------------------------------------------------
display "Forecast for unemployment in 1998: " _b[_cons]+_b[unem]*5.35+_b[inf_1]*inf1997
Forecast for unemployment in 1998: 5.3661276
This page prepared by Oleksandr Talavera (revised 9 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