-------------------------------------------------------------------------------- log: C:\Documents and Settings\Patricia_Anderson\My Documents\ECON 20\In > Class\dec4.log log type: text opened on: 4 Dec 2002, 11:12:35 . use intqrt . desc Contains data from intqrt.dta obs: 124 vars: 24 2 Dec 2002 10:23 size: 12,400 (100.0% of memory free) ------------------------------------------------------------------------------- storage display value variable name type format label variable label ------------------------------------------------------------------------------- r3 float %9.0g bond equiv. yield, 3 mo. T-bill r6 float %9.0g bond equiv. yield, 6 mo. T-bill r12 float %9.0g yield on 1 yr. bond p3 float %9.0g price of 3 mo. T-bill p6 float %9.0g price of 6 mo. T-bill hy6 float %9.0g holding yield: 100*(p3 - p6[t-1])/p6[t-1]) hy3 float %9.0g holding yield: r3*(91/365) spr63 float %9.0g spread: r6 - r3 hy3_1 float %9.0g hy3[t-1] hy6_1 float %9.0g hy6[t-1] spr63_1 float %9.0g spr63[t-1] hy6hy3_1 float %9.0g hy6 - hy3_1 cr3 float %9.0g r3 - r3_1 r3_1 float %9.0g r3[t-1] chy6 float %9.0g hy6 - hy6_1 chy3 float %9.0g hy3 - hy3_1 chy6_1 float %9.0g chy6[t-1] chy3_1 float %9.0g chy3[t-1] cr6 float %9.0g r6 - r6_1 cr6_1 float %9.0g cr6[t-1] cr3_1 float %9.0g cr3[t-1] r6_1 float %9.0g r6[t-1] cspr63 float %9.0g spr63 - spr63_1 t float %9.0g ------------------------------------------------------------------------------- Sorted by: . **both 3 month and 6 month rates are I(1) . dfuller r3, regress time variable not set, use -tsset varname ...- r(111); . tsset t time variable: t, 1 to 124 . dfuller r3, regress Dickey-Fuller test for unit root Number of obs = 123 ---------- Interpolated Dickey-Fuller --------- Test 1% Critical 5% Critical 10% Critical Statistic Value Value Value ------------------------------------------------------------------------------ Z(t) -2.473 -3.502 -2.888 -2.578 ------------------------------------------------------------------------------ * MacKinnon approximate p-value for Z(t) = 0.1221 ------------------------------------------------------------------------------ D.r3 | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- r3 | L1 | -.0907106 .0366782 -2.47 0.015 -.1633247 -.0180965 _cons | .6253371 .2608254 2.40 0.018 .1089645 1.14171 ------------------------------------------------------------------------------ . dfuller r6, regress Dickey-Fuller test for unit root Number of obs = 123 ---------- Interpolated Dickey-Fuller --------- Test 1% Critical 5% Critical 10% Critical Statistic Value Value Value ------------------------------------------------------------------------------ Z(t) -2.469 -3.502 -2.888 -2.578 ------------------------------------------------------------------------------ * MacKinnon approximate p-value for Z(t) = 0.1233 ------------------------------------------------------------------------------ D.r6 | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- r6 | L1 | -.0900915 .0364964 -2.47 0.015 -.1623456 -.0178373 _cons | .6463412 .2710257 2.38 0.019 .1097743 1.182908 ------------------------------------------------------------------------------ . **spr63=r6-r3 so it's the spread between the 2 interest rates . **see if the spread has a unit root or not . dfuller spr63 Dickey-Fuller test for unit root Number of obs = 123 ---------- Interpolated Dickey-Fuller --------- Test 1% Critical 5% Critical 10% Critical Statistic Value Value Value ------------------------------------------------------------------------------ Z(t) -7.710 -3.502 -2.888 -2.578 ------------------------------------------------------------------------------ * MacKinnon approximate p-value for Z(t) = 0.0000 . dfuller spr63, regess regess invalid r(198); . dfuller spr63, regress Dickey-Fuller test for unit root Number of obs = 123 ---------- Interpolated Dickey-Fuller --------- Test 1% Critical 5% Critical 10% Critical Statistic Value Value Value ------------------------------------------------------------------------------ Z(t) -7.710 -3.502 -2.888 -2.578 ------------------------------------------------------------------------------ * MacKinnon approximate p-value for Z(t) = 0.0000 ------------------------------------------------------------------------------ D.spr63 | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- spr63 | L1 | -.6661949 .0864051 -7.71 0.000 -.8372566 -.4951332 _cons | .2009128 .0350446 5.73 0.000 .1315328 .2702929 ------------------------------------------------------------------------------ . **suppose we weren't sure if parameter of cointegration was really 1 . **we can estimate it . 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 ------------------------------------------------------------------------------ . predict uhat, resid . **testing if the residual has a unit root is a test of cointegration . dfuller uhat, regress Dickey-Fuller test for unit root Number of obs = 123 ---------- Interpolated Dickey-Fuller --------- Test 1% Critical 5% Critical 10% Critical Statistic Value Value Value ------------------------------------------------------------------------------ Z(t) -8.353 -3.502 -2.888 -2.578 ------------------------------------------------------------------------------ * MacKinnon approximate p-value for Z(t) = 0.0000 ------------------------------------------------------------------------------ D.uhat | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- uhat | L1 | -.7412654 .0887422 -8.35 0.000 -.916954 -.5655767 _cons | -.0011873 .0226093 -0.05 0.958 -.0459483 .0435737 ------------------------------------------------------------------------------ . **reject unit root in residual so cointegrated with parameter of 1.03 . use fertil3, clear . **turns out we have unit roots in fertility and tax laws . **so let's see if maybe they are cointegrated . reg gfr pe t 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 t | -.9051881 .1089923 -8.31 0.000 -1.122622 -.6877543 _cons | 109.9302 3.47526 31.63 0.000 102.9972 116.8631 ------------------------------------------------------------------------------ . predict uhat, resid . **test for a unit root in the residual (i.e. are they cointegrated with param > eter .187?) . dfuller uhat, regress trend lag(1) time variable not set, use -tsset varname ...- r(111); . tsset t time variable: t, 1 to 72 . dfuller uhat, regress trend lag(1) 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.3700 ------------------------------------------------------------------------------ D.uhat | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- uhat | 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 ------------------------------------------------------------------------------ . **can't reject a unit root, so must reject that are cointegrated, need to use > both in changes . reg cgfr cpe cpe_1 Source | SS df MS Number of obs = 70 -------------+------------------------------ F( 2, 67) = 1.20 Model | 43.7985404 2 21.8992702 Prob > F = 0.3063 Residual | 1218.19554 67 18.1820231 R-squared = 0.0347 -------------+------------------------------ Adj R-squared = 0.0059 Total | 1261.99409 69 18.2897693 Root MSE = 4.264 ------------------------------------------------------------------------------ cgfr | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- cpe | -.0456497 .0294689 -1.55 0.126 -.1044699 .0131704 cpe_1 | .0134149 .0295326 0.45 0.651 -.0455324 .0723623 _cons | -.8372962 .5117337 -1.64 0.106 -1.858721 .1841286 ------------------------------------------------------------------------------ . test cpe+cpe_1=0 ( 1) cpe + cpe_1 = 0.0 F( 1, 67) = 0.78 Prob > F = 0.3808 . reg cgfr cpe cpe_1 pill ww2 t Source | SS df MS Number of obs = 70 -------------+------------------------------ F( 5, 64) = 3.84 Model | 291.500865 5 58.300173 Prob > F = 0.0042 Residual | 970.49322 64 15.1639566 R-squared = 0.2310 -------------+------------------------------ Adj R-squared = 0.1709 Total | 1261.99409 69 18.2897693 Root MSE = 3.8941 ------------------------------------------------------------------------------ cgfr | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- cpe | -.0937263 .0326185 -2.87 0.006 -.1588893 -.0285633 cpe_1 | -.0433145 .0347648 -1.25 0.217 -.1127651 .0261361 pill | -4.81226 1.72557 -2.79 0.007 -8.259483 -1.365038 ww2 | 6.642705 2.832324 2.35 0.022 .9844873 12.30092 t | .0786044 .039689 1.98 0.052 -.0006835 .1578923 _cons | -2.614437 1.183516 -2.21 0.031 -4.978782 -.2500909 ------------------------------------------------------------------------------ . **can get a relationship in changes, just not a long-term one . **remember about testing for serial correlation . ** take a simple model (ignore the unit root problem) . reg gfr pe t pill ww2 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 t | -1.149872 .1879038 -6.12 0.000 -1.524929 -.7748146 pill | .9974479 6.26163 0.16 0.874 -11.50082 13.49571 ww2 | -35.59228 6.297377 -5.65 0.000 -48.1619 -23.02266 _cons | 111.7694 3.357765 33.29 0.000 105.0673 118.4716 ------------------------------------------------------------------------------ . predict uhat uhat already defined r(110); . drop uhat . predict uhat, resid . gen uhat_1=uhat[_n-1] (1 missing value generated) . **test for AR(1) without strict exog . reg uhat uhat_1 pe t pill ww2 Source | SS df MS Number of obs = 71 -------------+------------------------------ F( 5, 65) = 30.82 Model | 6474.45362 5 1294.89072 Prob > F = 0.0000 Residual | 2731.15489 65 42.0177676 R-squared = 0.7033 -------------+------------------------------ Adj R-squared = 0.6805 Total | 9205.60851 70 131.508693 Root MSE = 6.4821 ------------------------------------------------------------------------------ uhat | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- uhat_1 | .8488487 .0684526 12.40 0.000 .7121394 .9855579 pe | -.0470048 .0222093 -2.12 0.038 -.0913598 -.0026498 t | .2611207 .1058069 2.47 0.016 .0498097 .4724317 pill | -7.269522 3.491964 -2.08 0.041 -14.24345 -.2955891 ww2 | 2.126565 3.45039 0.62 0.540 -4.764341 9.01747 _cons | -2.827407 1.914229 -1.48 0.144 -6.650385 .9955717 ------------------------------------------------------------------------------ . **can get same test statistic by just adding uhat_1 to original model . reg gfr pe t pill ww2 uhat_1 Source | SS df MS Number of obs = 71 -------------+------------------------------ F( 5, 65) = 115.47 Model | 24259.8881 5 4851.97763 Prob > F = 0.0000 Residual | 2731.15488 65 42.0177675 R-squared = 0.8988 -------------+------------------------------ Adj R-squared = 0.8910 Total | 26991.043 70 385.586329 Root MSE = 6.4821 ------------------------------------------------------------------------------ gfr | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- pe | .231873 .0222093 10.44 0.000 .187518 .276228 t | -.8887513 .1058069 -8.40 0.000 -1.100062 -.6774403 pill | -6.272073 3.491964 -1.80 0.077 -13.24601 .7018593 ww2 | -33.46572 3.45039 -9.70 0.000 -40.35662 -26.57481 uhat_1 | .8488486 .0684526 12.40 0.000 .7121394 .9855579 _cons | 108.942 1.914229 56.91 0.000 105.119 112.765 ------------------------------------------------------------------------------ . log close log: C:\Documents and Settings\Patricia_Anderson\My Documents\ECON 20\I > nClass\dec4.log log type: text closed on: 4 Dec 2002, 12:27:57 -------------------------------------------------------------------------------