-------------------------------------------------------------------------------- log: C:\Documents and Settings\Patricia_Anderson\My Documents\ECON 20\In > Class\dec2.log log type: text opened on: 2 Dec 2002, 11:15:14 . use phillips . **correcting standard errors for serial correlation . tsset year time variable: year, 1948 to 1996 . newey inf unem, lag(5) Regression with Newey-West standard errors Number of obs = 49 maximum lag : 5 F( 1, 47) = 2.63 Prob > F = 0.1114 ------------------------------------------------------------------------------ | Newey-West inf | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- unem | .4676257 .288193 1.62 0.111 -.1121439 1.047395 _cons | 1.42361 1.480271 0.96 0.341 -1.554312 4.401532 ------------------------------------------------------------------------------ . **compare to OLS . 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 ------------------------------------------------------------------------------ . **use iterating cochrane-orcutt as our FGLS method . prais inf unem, corc Iteration 0: rho = 0.0000 Iteration 1: rho = 0.5727 Iteration 2: rho = 0.7160 Iteration 3: rho = 0.7611 Iteration 4: rho = 0.7715 Iteration 5: rho = 0.7735 Iteration 6: rho = 0.7740 Iteration 7: rho = 0.7740 Iteration 8: rho = 0.7740 Iteration 9: rho = 0.7741 Iteration 10: rho = 0.7741 Cochrane-Orcutt AR(1) regression -- iterated estimates Source | SS df MS Number of obs = 48 -------------+------------------------------ F( 1, 46) = 4.33 Model | 22.4790685 1 22.4790685 Prob > F = 0.0430 Residual | 238.604008 46 5.18704365 R-squared = 0.0861 -------------+------------------------------ Adj R-squared = 0.0662 Total | 261.083076 47 5.55495907 Root MSE = 2.2775 ------------------------------------------------------------------------------ inf | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- unem | -.6653356 .3196035 -2.08 0.043 -1.308664 -.0220071 _cons | 7.583458 2.38053 3.19 0.003 2.7917 12.37522 -------------+---------------------------------------------------------------- rho | .7740512 ------------------------------------------------------------------------------ Durbin-Watson statistic (original) 0.802700 Durbin-Watson statistic (transformed) 1.593634 . use nyse . desc Contains data from nyse.dta obs: 691 vars: 8 13 Sep 2000 15:34 size: 23,494 (100.0% of memory free) ------------------------------------------------------------------------------- storage display value variable name type format label variable label ------------------------------------------------------------------------------- price float %9.0g NYSE stock price index return float %9.0g 100*(p - p(-1])/p(-1)) return_1 float %9.0g lagged return t int %9.0g time trend: 1 to 691 price_1 float %9.0g price(-1) price_2 float %9.0g price(-2) cprice float %9.0g price - price_1 cprice_1 float %9.0g cprice(-1) ------------------------------------------------------------------------------- Sorted by: . graph price t . **do a dickey-fuller test by hand . reg cprice price_1 Source | SS df MS Number of obs = 690 -------------+------------------------------ F( 1, 688) = 0.00 Model | .005457999 1 .005457999 Prob > F = 0.9745 Residual | 3681.33871 688 5.35078301 R-squared = 0.0000 -------------+------------------------------ Adj R-squared = -0.0015 Total | 3681.34417 689 5.34302492 Root MSE = 2.3132 ------------------------------------------------------------------------------ cprice | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- price_1 | -.0000742 .002324 -0.03 0.975 -.0046371 .0044887 _cons | .1727321 .2301193 0.75 0.453 -.2790882 .6245525 ------------------------------------------------------------------------------ . **stata can do this and report the correct critical values . tsset t time variable: t, 1 to 691 . dfuller price, regress Dickey-Fuller test for unit root Number of obs = 690 ---------- Interpolated Dickey-Fuller --------- Test 1% Critical 5% Critical 10% Critical Statistic Value Value Value ------------------------------------------------------------------------------ Z(t) -0.032 -3.430 -2.860 -2.570 ------------------------------------------------------------------------------ * MacKinnon approximate p-value for Z(t) = 0.9558 ------------------------------------------------------------------------------ D.price | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- price | L1 | -.0000742 .002324 -0.03 0.975 -.0046371 .0044887 _cons | .1727321 .2301193 0.75 0.453 -.2790882 .6245525 ------------------------------------------------------------------------------ . desc Contains data from nyse.dta obs: 691 vars: 8 13 Sep 2000 15:34 size: 23,494 (100.0% of memory free) ------------------------------------------------------------------------------- storage display value variable name type format label variable label ------------------------------------------------------------------------------- price float %9.0g NYSE stock price index return float %9.0g 100*(p - p(-1])/p(-1)) return_1 float %9.0g lagged return t int %9.0g time trend: 1 to 691 price_1 float %9.0g price(-1) price_2 float %9.0g price(-2) cprice float %9.0g price - price_1 cprice_1 float %9.0g cprice(-1) ------------------------------------------------------------------------------- Sorted by: t . **we have a unit root, need to use differences, how about returns? . dfuller return, regress Dickey-Fuller test for unit root Number of obs = 689 ---------- Interpolated Dickey-Fuller --------- Test 1% Critical 5% Critical 10% Critical Statistic Value Value Value ------------------------------------------------------------------------------ Z(t) -24.751 -3.430 -2.860 -2.570 ------------------------------------------------------------------------------ * MacKinnon approximate p-value for Z(t) = 0.0000 ------------------------------------------------------------------------------ D.return | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- return | L1 | -.9411016 .0380231 -24.75 0.000 -1.015757 -.8664462 _cons | .179634 .0807419 2.22 0.026 .0211034 .3381646 ------------------------------------------------------------------------------ . **really stock prices are a unit root with a trend . dfuller price, regress trend Dickey-Fuller test for unit root Number of obs = 690 ---------- Interpolated Dickey-Fuller --------- Test 1% Critical 5% Critical 10% Critical Statistic Value Value Value ------------------------------------------------------------------------------ Z(t) -2.280 -3.960 -3.410 -3.120 ------------------------------------------------------------------------------ * MacKinnon approximate p-value for Z(t) = 0.4463 ------------------------------------------------------------------------------ D.price | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- price | L1 | -.014144 .0062027 -2.28 0.023 -.0263226 -.0019654 _trend | .0028852 .00118 2.45 0.015 .0005684 .005202 _cons | .4630457 .2582094 1.79 0.073 -.0439286 .9700201 ------------------------------------------------------------------------------ . **can also do an augmented D-F . dfuller price, regress trend lag(1) Augmented Dickey-Fuller test for unit root Number of obs = 689 ---------- Interpolated Dickey-Fuller --------- Test 1% Critical 5% Critical 10% Critical Statistic Value Value Value ------------------------------------------------------------------------------ Z(t) -2.534 -3.960 -3.410 -3.120 ------------------------------------------------------------------------------ * MacKinnon approximate p-value for Z(t) = 0.3118 ------------------------------------------------------------------------------ D.price | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- price | L1 | -.0157155 .0062008 -2.53 0.011 -.0278904 -.0035405 LD | .104453 .0379483 2.75 0.006 .0299441 .178962 _trend | .0031474 .0011797 2.67 0.008 .0008311 .0054638 _cons | .4961538 .2573977 1.93 0.054 -.0092293 1.001537 ------------------------------------------------------------------------------ . use traffic2 . desc Contains data from traffic2.dta obs: 108 vars: 48 13 Sep 2000 15:38 size: 12,312 (100.0% of memory free) ------------------------------------------------------------------------------- storage display value variable name type format label variable label ------------------------------------------------------------------------------- year int %9.0g 1981 to 1989 totacc float %9.0g statewide total accidents fatacc int %9.0g statewide fatal accidents injacc int %9.0g statewide injury accidents pdoacc int %9.0g property damage only accidents ntotacc float %9.0g noninterstate total acc nfatacc int %9.0g noninterstate fatal acc ninjacc int %9.0g noninterstate injur acc npdoacc int %9.0g noninterstate property acc rtotacc int %9.0g total acc on rural 65 mph roads rfatacc byte %9.0g fatal acc on rural 65 mph roads rinjacc int %9.0g injury acc on rural 65 mph roads rpdoacc int %9.0g property acc on rural 65 mph roads ushigh int %9.0g acc on US highways cntyrds int %9.0g acc on county roads strtes int %9.0g acc on state routes t byte %9.0g time trend tsq int %9.0g t^2 unem float %9.0g state unemployment rate spdlaw byte %9.0g =1 after 65 mph in effect beltlaw byte %9.0g =1 after seatbelt law wkends byte %9.0g # weekends in month feb byte %9.0g =1 if month is Feb mar byte %9.0g apr byte %9.0g may byte %9.0g jun byte %9.0g jul byte %9.0g aug byte %9.0g sep byte %9.0g oct byte %9.0g nov byte %9.0g dec byte %9.0g ltotacc float %9.0g log(totacc) lfatacc float %9.0g log(fatacc) prcfat float %9.0g 100*(fatacc/totacc) prcrfat float %9.0g 100*(rfatacc/rtotacc) lrtotacc float %9.0g log(rtotacc) lrfatacc float %9.0g log(rfatacc) lntotacc float %9.0g log(ntotacc) lnfatacc float %9.0g log(nfatacc) prcnfat float %9.0g 100*(nfatacc/ntotacc) lushigh float %9.0g log(ushigh) lcntyrds float %9.0g log(cntyrds) lstrtes float %9.0g log(strtes) spdt byte %9.0g spdlaw*t beltt byte %9.0g beltlaw*t prcfat_1 float %9.0g prcfat[t-1] ------------------------------------------------------------------------------- Sorted by: . **concerned that log total accidents have a unit root . **plain D-F test . dfuller ltotacc, regress time variable not set, use -tsset varname ...- r(111); . tsset t time variable: t, 1 to 108 . dfuller ltotacc, regress Dickey-Fuller test for unit root Number of obs = 107 ---------- Interpolated Dickey-Fuller --------- Test 1% Critical 5% Critical 10% Critical Statistic Value Value Value ------------------------------------------------------------------------------ Z(t) -3.311 -3.508 -2.890 -2.580 ------------------------------------------------------------------------------ * MacKinnon approximate p-value for Z(t) = 0.0144 ------------------------------------------------------------------------------ D.ltotacc | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- ltotacc | L1 | -.192334 .0580979 -3.31 0.001 -.3075314 -.0771365 _cons | 2.051384 .6192548 3.31 0.001 .8235162 3.279252 ------------------------------------------------------------------------------ . **try adding a trend . dfuller ltotacc, regress trend Dickey-Fuller test for unit root Number of obs = 107 ---------- Interpolated Dickey-Fuller --------- Test 1% Critical 5% Critical 10% Critical Statistic Value Value Value ------------------------------------------------------------------------------ Z(t) -6.858 -4.038 -3.449 -3.149 ------------------------------------------------------------------------------ * MacKinnon approximate p-value for Z(t) = 0.0000 ------------------------------------------------------------------------------ D.ltotacc | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- ltotacc | L1 | -.6122528 .0892704 -6.86 0.000 -.7892793 -.4352262 _trend | .0017866 .000312 5.73 0.000 .0011679 .0024053 _cons | 6.430512 .9376911 6.86 0.000 4.571036 8.289989 ------------------------------------------------------------------------------ . **try augmenting instead of trend . dfuller ltotacc, regress lag(2) Augmented Dickey-Fuller test for unit root Number of obs = 105 ---------- Interpolated Dickey-Fuller --------- Test 1% Critical 5% Critical 10% Critical Statistic Value Value Value ------------------------------------------------------------------------------ Z(t) -1.501 -3.508 -2.890 -2.580 ------------------------------------------------------------------------------ * MacKinnon approximate p-value for Z(t) = 0.5311 ------------------------------------------------------------------------------ D.ltotacc | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- ltotacc | L1 | -.0850309 .056632 -1.50 0.136 -.1973736 .0273118 LD | -.472746 .0995574 -4.75 0.000 -.6702411 -.2752508 L2D | -.2870017 .0937244 -3.06 0.003 -.4729257 -.1010776 _cons | .9097548 .6036057 1.51 0.135 -.2876364 2.107146 ------------------------------------------------------------------------------ . **try both . dfuller ltotacc, regress lag(2) trend Augmented Dickey-Fuller test for unit root Number of obs = 105 ---------- Interpolated Dickey-Fuller --------- Test 1% Critical 5% Critical 10% Critical Statistic Value Value Value ------------------------------------------------------------------------------ Z(t) -3.666 -4.038 -3.449 -3.149 ------------------------------------------------------------------------------ * MacKinnon approximate p-value for Z(t) = 0.0247 ------------------------------------------------------------------------------ D.ltotacc | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- ltotacc | L1 | -.4252736 .1160123 -3.67 0.000 -.6554386 -.1951086 LD | -.2525627 .1159058 -2.18 0.032 -.4825165 -.0226088 L2D | -.1724855 .0958546 -1.80 0.075 -.3626582 .0176873 _trend | .0012686 .0003828 3.31 0.001 .0005092 .002028 _cons | 4.466274 1.217873 3.67 0.000 2.050049 6.882499 ------------------------------------------------------------------------------ . graph ltotacc t . log close log: C:\Documents and Settings\Patricia_Anderson\My Documents\ECON 20\I > nClass\dec2.log log type: text closed on: 2 Dec 2002, 12:14:51 -------------------------------------------------------------------------------