___ ____ ____ ____ ____ (R) /__ / ____/ / ____/ ___/ / /___/ / /___/ 13.1 Copyright 1985-2013 StataCorp LP Statistics/Data Analysis StataCorp 4905 Lakeway Drive Special Edition College Station, Texas 77845 USA 800-STATA-PC http://www.stata.com 979-696-4600 stata@stata.com 979-696-4601 (fax) Single-user Stata perpetual license: Serial number: 401306001168 Licensed to: Houston H. Stokes Econometric Software and Consulting Notes: 1. (/v# option or -set maxvar-) 5000 maximum variables 2. Stata running in batch mode . do p_20.do . clear . import excel using "c:\master\master1\class\e323\hanke\p_20.xlsx",firstrow . summ Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- year | 23 12 6.78233 1 23 chicken | 23 38.9 6.499021 28 49.6 income | 23 1035.065 617.847 397.5 2478.7 pchicken | 23 47.99565 11.11721 37.3 70.4 ppork | 23 90.4 35.22369 50.7 168.2 -------------+-------------------------------------------------------- pbeef | 23 124.4304 51.49974 77.4 232.6 . corr (obs=23) | year chicken income pchicken ppork pbeef -------------+------------------------------------------------------ year | 1.0000 chicken | 0.9633 1.0000 income | 0.9392 0.9219 1.0000 pchicken | 0.8827 0.7937 0.9317 1.0000 ppork | 0.9471 0.8710 0.9571 0.9701 1.0000 pbeef | 0.9234 0.9134 0.9859 0.9285 0.9406 1.0000 . tsset year time variable: year, 1 to 23 delta: 1 unit . * OLS Regress with DW test . * with and without time . regress chicken income pchicken ppork pbeef year Source | SS df MS Number of obs = 23 -------------+------------------------------ F( 5, 17) = 145.54 Model | 908.007077 5 181.601415 Prob > F = 0.0000 Residual | 21.2129229 17 1.24781899 R-squared = 0.9772 -------------+------------------------------ Adj R-squared = 0.9705 Total | 929.22 22 42.2372727 Root MSE = 1.1171 ------------------------------------------------------------------------------ chicken | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- income | .0033937 .0028039 1.21 0.243 -.0025221 .0093094 pchicken | -.2143723 .1103186 -1.94 0.069 -.4471242 .0183795 ppork | -.0658175 .0491961 -1.34 0.199 -.1696121 .0379771 pbeef | .0435068 .029643 1.47 0.160 -.0190345 .1060481 year | .9615598 .1384865 6.94 0.000 .6693789 1.253741 _cons | 34.67391 2.227797 15.56 0.000 29.97367 39.37415 ------------------------------------------------------------------------------ . estat dwatson Durbin-Watson d-statistic( 6, 23) = 1.670529 . predict resid1, resid . gen b= _b[income] . display b .00339365 . . regress chicken income pchicken ppork pbeef Source | SS df MS Number of obs = 23 -------------+------------------------------ F( 4, 18) = 46.89 Model | 847.849621 4 211.962405 Prob > F = 0.0000 Residual | 81.3703787 18 4.52057659 R-squared = 0.9124 -------------+------------------------------ Adj R-squared = 0.8930 Total | 929.22 22 42.2372727 Root MSE = 2.1262 ------------------------------------------------------------------------------ chicken | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- income | .0046278 .0053262 0.87 0.396 -.006562 .0158177 pchicken | -.6249116 .1772701 -3.53 0.002 -.9973423 -.2524809 ppork | .1636477 .0693635 2.36 0.030 .0179204 .3093751 pbeef | .0805042 .0555024 1.45 0.164 -.036102 .1971103 _cons | 39.29199 4.046918 9.71 0.000 30.78973 47.79425 ------------------------------------------------------------------------------ . estat dwatson Durbin-Watson d-statistic( 5, 23) = 1.083311 . predict resid2, resid . . list chicken resid1 resid2 +---------------------------------+ | chicken resid1 resid2 | |---------------------------------| 1. | 28 -.0075647 -1.360709 | 2. | 29.9 .044736 -2.381162 | 3. | 30.1 -.2014653 -1.253513 | 4. | 30.9 -.51853 -1.261055 | 5. | 31.4 -1.525556 -2.046409 | |---------------------------------| 6. | 33.7 .333767 -1.109935 | 7. | 35.6 1.814661 .3789039 | 8. | 35.6 -.0956313 -.4995724 | 9. | 37.1 .2678223 1.282231 | 10. | 38.5 .9015025 1.946512 | |---------------------------------| 11. | 40.3 .9184763 1.053977 | 12. | 40.2 -.4395557 2.344673 | 13. | 41.7 .1891365 .8762419 | 14. | 39.9 .6530243 3.254352 | 15. | 39.7 -1.732568 .5508905 | |---------------------------------| 16. | 39 -.6062714 -.9697943 | 17. | 39.1 -1.786216 -3.073593 | 18. | 42.8 -.3047093 1.656758 | 19. | 44.9 1.680417 3.378775 | 20. | 48.3 1.328645 1.753743 | |---------------------------------| 21. | 49 -1.137199 -1.339177 | 22. | 49.4 -.2179366 .237942 | 23. | 49.6 .4410155 -3.420079 | +---------------------------------+ . stepwise, pr(.05): regress chicken income pchicken ppork pbeef begin with full model p = 0.3963 >= 0.0500 removing income Source | SS df MS Number of obs = 23 -------------+------------------------------ F( 3, 19) = 63.08 Model | 844.436725 3 281.478908 Prob > F = 0.0000 Residual | 84.7832754 19 4.46227765 R-squared = 0.9088 -------------+------------------------------ Adj R-squared = 0.8944 Total | 929.22 22 42.2372727 Root MSE = 2.1124 ------------------------------------------------------------------------------ chicken | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- pbeef | .1229146 .0262507 4.68 0.000 .0679713 .177858 pchicken | -.6645552 .1701898 -3.90 0.001 -1.020767 -.3083438 ppork | .1951596 .0587447 3.32 0.004 .0722056 .3181135 _cons | 37.85901 3.671722 10.31 0.000 30.17401 45.54402 ------------------------------------------------------------------------------ . estat dwatson Durbin-Watson d-statistic( 4, 23) = 1.239248 . * . * GLS correction . * . prais chicken income pchicken ppork pbeef year Iteration 0: rho = 0.0000 Iteration 1: rho = 0.1616 Iteration 2: rho = 0.2747 Iteration 3: rho = 0.3651 Iteration 4: rho = 0.4352 Iteration 5: rho = 0.4845 Iteration 6: rho = 0.5152 Iteration 7: rho = 0.5326 Iteration 8: rho = 0.5418 Iteration 9: rho = 0.5466 Iteration 10: rho = 0.5490 Iteration 11: rho = 0.5502 Iteration 12: rho = 0.5508 Iteration 13: rho = 0.5511 Iteration 14: rho = 0.5512 Iteration 15: rho = 0.5513 Iteration 16: rho = 0.5513 Iteration 17: rho = 0.5514 Iteration 18: rho = 0.5514 Iteration 19: rho = 0.5514 Iteration 20: rho = 0.5514 Iteration 21: rho = 0.5514 Iteration 22: rho = 0.5514 Prais-Winsten AR(1) regression -- iterated estimates Source | SS df MS Number of obs = 23 -------------+------------------------------ F( 5, 17) = 33.35 Model | 187.039813 5 37.4079627 Prob > F = 0.0000 Residual | 19.0674473 17 1.12161455 R-squared = 0.9075 -------------+------------------------------ Adj R-squared = 0.8803 Total | 206.107261 22 9.36851185 Root MSE = 1.0591 ------------------------------------------------------------------------------ chicken | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- income | .0005585 .0029092 0.19 0.850 -.0055795 .0066964 pchicken | -.1409933 .0924978 -1.52 0.146 -.3361467 .05416 ppork | -.0386995 .0414897 -0.93 0.364 -.1262351 .0488361 pbeef | .0502338 .0290542 1.73 0.102 -.0110652 .1115328 year | .9295908 .1839719 5.05 0.000 .5414441 1.317738 _cons | 31.18415 2.478206 12.58 0.000 25.9556 36.41271 -------------+---------------------------------------------------------------- rho | .5513667 ------------------------------------------------------------------------------ Durbin-Watson statistic (original) 1.670529 Durbin-Watson statistic (transformed) 1.717119 . * . prais chicken income pchicken ppork pbeef Iteration 0: rho = 0.0000 Iteration 1: rho = 0.4381 Iteration 2: rho = 0.7264 Iteration 3: rho = 0.7966 Iteration 4: rho = 0.8154 Iteration 5: rho = 0.8216 Iteration 6: rho = 0.8239 Iteration 7: rho = 0.8248 Iteration 8: rho = 0.8251 Iteration 9: rho = 0.8252 Iteration 10: rho = 0.8253 Iteration 11: rho = 0.8253 Iteration 12: rho = 0.8253 Iteration 13: rho = 0.8253 Iteration 14: rho = 0.8253 Prais-Winsten AR(1) regression -- iterated estimates Source | SS df MS Number of obs = 23 -------------+------------------------------ F( 4, 18) = 10.30 Model | 81.2525651 4 20.3131413 Prob > F = 0.0002 Residual | 35.4902972 18 1.97168318 R-squared = 0.6960 -------------+------------------------------ Adj R-squared = 0.6284 Total | 116.742862 22 5.30649374 Root MSE = 1.4042 ------------------------------------------------------------------------------ chicken | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- income | .0065631 .0033125 1.98 0.063 -.0003962 .0135223 pchicken | -.1447427 .111772 -1.29 0.212 -.379567 .0900816 ppork | -.0089712 .0499731 -0.18 0.860 -.1139608 .0960184 pbeef | .0598292 .0363716 1.64 0.117 -.0165846 .136243 _cons | 31.48036 3.884935 8.10 0.000 23.31842 39.64231 -------------+---------------------------------------------------------------- rho | .8252797 ------------------------------------------------------------------------------ Durbin-Watson statistic (original) 1.083311 Durbin-Watson statistic (transformed) 1.482226 . * . prais chicken income pchicken ppork pbeef, corc Iteration 0: rho = 0.0000 Iteration 1: rho = 0.4381 Iteration 2: rho = 0.7575 Iteration 3: rho = 0.7951 Iteration 4: rho = 0.8126 Iteration 5: rho = 0.8230 Iteration 6: rho = 0.8299 Iteration 7: rho = 0.8346 Iteration 8: rho = 0.8382 Iteration 9: rho = 0.8408 Iteration 10: rho = 0.8428 Iteration 11: rho = 0.8444 Iteration 12: rho = 0.8456 Iteration 13: rho = 0.8466 Iteration 14: rho = 0.8474 Iteration 15: rho = 0.8480 Iteration 16: rho = 0.8486 Iteration 17: rho = 0.8490 Iteration 18: rho = 0.8493 Iteration 19: rho = 0.8496 Iteration 20: rho = 0.8498 Iteration 21: rho = 0.8500 Iteration 22: rho = 0.8501 Iteration 23: rho = 0.8503 Iteration 24: rho = 0.8504 Iteration 25: rho = 0.8505 Iteration 26: rho = 0.8505 Iteration 27: rho = 0.8506 Iteration 28: rho = 0.8506 Iteration 29: rho = 0.8507 Iteration 30: rho = 0.8507 Iteration 31: rho = 0.8507 Iteration 32: rho = 0.8508 Iteration 33: rho = 0.8508 Iteration 34: rho = 0.8508 Iteration 35: rho = 0.8508 Iteration 36: rho = 0.8508 Iteration 37: rho = 0.8508 Iteration 38: rho = 0.8508 Iteration 39: rho = 0.8508 Iteration 40: rho = 0.8508 Iteration 41: rho = 0.8508 Iteration 42: rho = 0.8508 Iteration 43: rho = 0.8508 Iteration 44: rho = 0.8508 Iteration 45: rho = 0.8508 Iteration 46: rho = 0.8508 Iteration 47: rho = 0.8508 Iteration 48: rho = 0.8508 Cochrane-Orcutt AR(1) regression -- iterated estimates Source | SS df MS Number of obs = 22 -------------+------------------------------ F( 4, 17) = 4.92 Model | 25.7805743 4 6.44514358 Prob > F = 0.0080 Residual | 22.2475734 17 1.30868079 R-squared = 0.5368 -------------+------------------------------ Adj R-squared = 0.4278 Total | 48.0281477 21 2.28705465 Root MSE = 1.144 ------------------------------------------------------------------------------ chicken | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- income | .003999 .0028124 1.42 0.173 -.0019347 .0099327 pchicken | -.066788 .0932496 -0.72 0.484 -.2635273 .1299514 ppork | -.0438805 .0417498 -1.05 0.308 -.1319648 .0442039 pbeef | .0622498 .0294003 2.12 0.049 .0002206 .1242791 _cons | 37.31056 3.809043 9.80 0.000 29.27418 45.34694 -------------+---------------------------------------------------------------- rho | .850846 ------------------------------------------------------------------------------ Durbin-Watson statistic (original) 1.083311 Durbin-Watson statistic (transformed) 1.918700 . * . . * do GLS by hand . . regress chicken income pchicken ppork pbeef Source | SS df MS Number of obs = 23 -------------+------------------------------ F( 4, 18) = 46.89 Model | 847.849621 4 211.962405 Prob > F = 0.0000 Residual | 81.3703787 18 4.52057659 R-squared = 0.9124 -------------+------------------------------ Adj R-squared = 0.8930 Total | 929.22 22 42.2372727 Root MSE = 2.1262 ------------------------------------------------------------------------------ chicken | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- income | .0046278 .0053262 0.87 0.396 -.006562 .0158177 pchicken | -.6249116 .1772701 -3.53 0.002 -.9973423 -.2524809 ppork | .1636477 .0693635 2.36 0.030 .0179204 .3093751 pbeef | .0805042 .0555024 1.45 0.164 -.036102 .1971103 _cons | 39.29199 4.046918 9.71 0.000 30.78973 47.79425 ------------------------------------------------------------------------------ . predict residtest, resid . regress residtest L1.residtest Source | SS df MS Number of obs = 22 -------------+------------------------------ F( 1, 20) = 4.02 Model | 13.2870497 1 13.2870497 Prob > F = 0.0588 Residual | 66.1476404 20 3.30738202 R-squared = 0.1673 -------------+------------------------------ Adj R-squared = 0.1256 Total | 79.4346902 21 3.78260429 Root MSE = 1.8186 ------------------------------------------------------------------------------ residtest | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- residtest | L1. | .4383733 .2187117 2.00 0.059 -.0178513 .8945978 | _cons | -.0062983 .3892192 -0.02 0.987 -.8181953 .8055987 ------------------------------------------------------------------------------ . regress residtest L1.residtest, noconstant Source | SS df MS Number of obs = 22 -------------+------------------------------ F( 1, 21) = 4.24 Model | 13.370344 1 13.370344 Prob > F = 0.0520 Residual | 66.1485065 21 3.14992888 R-squared = 0.1681 -------------+------------------------------ Adj R-squared = 0.1285 Total | 79.5188505 22 3.61449321 Root MSE = 1.7748 ------------------------------------------------------------------------------ residtest | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- residtest | L1. | .4380641 .2126262 2.06 0.052 -.0041163 .8802445 ------------------------------------------------------------------------------ . gen rho = _b[L1.residtest] . display rho .4380641 . . * building transformed data . . gen nchicken = chicken - (rho * L1.chicken) (1 missing value generated) . gen nincome = income - (rho * L1.income) (1 missing value generated) . gen npchicken = pchicken - (rho * L1.pchicken) (1 missing value generated) . gen nppork = ppork - (rho * L1.ppork) (1 missing value generated) . gen npbeef = pbeef - (rho * L1.pbeef) (1 missing value generated) . . list +---------------------------------------------------------------------------------------+ 1. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 1 | 28 | 397.5 | 42.2 | 50.7 | 78.3 | -.0075647 | .0033937 | -1.360709 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | -1.360709 | .4380641 | . | . | . | . | . | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 2. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 2 | 29.9 | 413.3 | 38.1 | 52 | 79.2 | .044736 | .0033937 | -2.381162 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | -2.381162 | .4380641 | 17.6342 | 239.1695 | 19.6137 | 29.79015 | 44.89958 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 3. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 3 | 30.1 | 439.2 | 40.3 | 54 | 79.2 | -.2014653 | .0033937 | -1.253513 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | -1.253513 | .4380641 | 17.00188 | 258.1481 | 23.60976 | 31.22067 | 44.50533 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 4. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 4 | 30.9 | 459.7 | 39.5 | 55.3 | 79.2 | -.51853 | .0033937 | -1.261055 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | -1.261055 | .4380641 | 17.71427 | 267.3022 | 21.84602 | 31.64454 | 44.50533 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 5. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 5 | 31.4 | 492.9 | 37.3 | 54.7 | 77.4 | -1.525556 | .0033937 | -2.046409 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | -2.046409 | .4380641 | 17.86382 | 291.5219 | 19.99647 | 30.47506 | 42.70532 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 6. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 6 | 33.7 | 528.6 | 38.1 | 63.7 | 80.2 | .333767 | .0033937 | -1.109935 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | -1.109935 | .4380641 | 19.94479 | 312.6782 | 21.76021 | 39.73789 | 46.29384 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 7. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 7 | 35.6 | 560.3 | 39.3 | 69.8 | 80.4 | 1.814661 | .0033937 | .3789039 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | .3789039 | .4380641 | 20.83724 | 328.7393 | 22.60976 | 41.89532 | 45.26726 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 8. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 8 | 35.6 | 624.6 | 37.8 | 65.9 | 83.9 | -.0956313 | .0033937 | -.4995724 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | -.4995724 | .4380641 | 20.00492 | 379.1527 | 20.58408 | 35.32313 | 48.67965 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 9. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 9 | 37.1 | 666.4 | 38.4 | 64.5 | 85.5 | .2678223 | .0033937 | 1.282231 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | 1.282231 | .4380641 | 21.50492 | 392.7852 | 21.84118 | 35.63158 | 48.74642 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 10. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 10 | 38.5 | 717.8 | 40.1 | 70 | 93.7 | .9015025 | .0033937 | 1.946512 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | 1.946512 | .4380641 | 22.24782 | 425.8741 | 23.27834 | 41.74487 | 56.24552 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 11. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 11 | 40.3 | 768.2 | 38.6 | 73.2 | 106.1 | .9184763 | .0033937 | 1.053977 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | 1.053977 | .4380641 | 23.43453 | 453.7576 | 21.03363 | 42.53551 | 65.05339 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 12. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 12 | 40.2 | 843.3 | 39.8 | 67.8 | 104.8 | -.4395557 | .0033937 | 2.344673 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | 2.344673 | .4380641 | 22.54602 | 506.7792 | 22.89073 | 35.73371 | 58.3214 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 13. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 13 | 41.7 | 911.6 | 39.7 | 79.1 | 114 | .1891365 | .0033937 | .8762419 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | .8762419 | .4380641 | 24.08982 | 542.1805 | 22.26505 | 49.39925 | 68.09088 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 14. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 14 | 39.9 | 931.1 | 52.1 | 95.4 | 124.1 | .6530243 | .0033937 | 3.254352 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | 3.254352 | .4380641 | 21.63273 | 531.7607 | 34.70885 | 60.74913 | 74.16069 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 15. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 15 | 39.7 | 1021.5 | 48.9 | 94.2 | 127.6 | -1.732568 | .0033937 | .5508905 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | .5508905 | .4380641 | 22.22124 | 613.6185 | 26.07686 | 52.40868 | 73.23624 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 16. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 16 | 39 | 1165.9 | 58.3 | 123.5 | 142.9 | -.6062714 | .0033937 | -.9697943 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | -.9697943 | .4380641 | 21.60886 | 718.4175 | 36.87867 | 82.23436 | 87.00302 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 17. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 17 | 39.1 | 1349.6 | 57.9 | 129.9 | 143.6 | -1.786216 | .0033937 | -3.073593 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | -3.073593 | .4380641 | 22.0155 | 838.8611 | 32.36086 | 75.79909 | 81.00064 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 18. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 18 | 42.8 | 1449.4 | 56.5 | 117.6 | 139.2 | -.3047093 | .0033937 | 1.656758 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | 1.656758 | .4380641 | 25.67169 | 858.1887 | 31.13609 | 60.69547 | 76.294 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 19. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 19 | 44.9 | 1575.5 | 63.7 | 130.9 | 165.5 | 1.680417 | .0033937 | 3.378775 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | 3.378775 | .4380641 | 26.15086 | 940.5699 | 38.94938 | 79.38366 | 104.5215 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 20. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 20 | 48.3 | 1759.1 | 61.6 | 129.8 | 203.3 | 1.328645 | .0033937 | 1.753743 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | 1.753743 | .4380641 | 28.63092 | 1068.93 | 33.69532 | 72.45741 | 130.8004 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 21. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 21 | 49 | 1994.2 | 58.9 | 128 | 219.6 | -1.137199 | .0033937 | -1.339177 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | -1.339177 | .4380641 | 27.8415 | 1223.601 | 31.91525 | 71.13928 | 130.5416 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 22. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 22 | 49.4 | 2258.1 | 66.4 | 141 | 221.6 | -.2179366 | .0033937 | .237942 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | .237942 | .4380641 | 27.93486 | 1384.513 | 40.59803 | 84.9278 | 125.4011 | +---------------------------------------------------------------------------------------+ +---------------------------------------------------------------------------------------+ 23. | year | chicken | income | pchicken | ppork | pbeef | resid1 | b | resid2 | | 23 | 49.6 | 2478.7 | 70.4 | 168.2 | 232.6 | .4410155 | .0033937 | -3.420079 | |------------------------------------+--------------------------------------------------| | residtest | rho | nchicken | nincome | npchic~n | nppork | npbeef | | -3.420079 | .4380641 | 27.95963 | 1489.507 | 41.31255 | 106.433 | 135.525 | +---------------------------------------------------------------------------------------+ . . regress nchicken nincome npchicken nppork npbeef Source | SS df MS Number of obs = 22 -------------+------------------------------ F( 4, 17) = 24.25 Model | 228.786613 4 57.1966533 Prob > F = 0.0000 Residual | 40.1032079 17 2.35901223 R-squared = 0.8509 -------------+------------------------------ Adj R-squared = 0.8158 Total | 268.889821 21 12.8042772 Root MSE = 1.5359 ------------------------------------------------------------------------------ nchicken | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- nincome | .0058278 .0039174 1.49 0.155 -.0024372 .0140927 npchicken | -.1462729 .1506448 -0.97 0.345 -.4641058 .1715599 nppork | -.0067165 .0622875 -0.11 0.915 -.1381315 .1246985 npbeef | .0681854 .0425271 1.60 0.127 -.0215389 .1579097 _cons | 18.19681 1.983681 9.17 0.000 14.01161 22.38201 ------------------------------------------------------------------------------ . estat dwatson Durbin-Watson d-statistic( 5, 22) = .8447024 . predict residnew, resid (1 missing value generated) . corrgram residnew -1 0 1 -1 0 1 LAG AC PAC Q Prob>Q [Autocorrelation] [Partial Autocor] ------------------------------------------------------------------------------- 1 0.5058 0.5297 6.4332 0.0112 |---- |---- 2 0.2007 -0.0482 7.4969 0.0236 |- | 3 -0.0543 -0.1568 7.5787 0.0556 | -| 4 -0.0983 0.0304 7.8619 0.0968 | | 5 -0.1066 -0.1008 8.2149 0.1448 | | 6 -0.0026 0.1027 8.2152 0.2228 | | 7 -0.1091 -0.2598 8.634 0.2800 | --| 8 -0.1912 -0.4415 10.013 0.2641 -| ---| 9 -0.1679 -0.3610 11.158 0.2650 -| --| . . drop rho nchicken nincome npchicken nppork npbeef . . gen rho = .8252797 . display rho .82527971 . . * building transformed data . . gen nchicken = chicken - (rho * L1.chicken) (1 missing value generated) . gen nincome = income - (rho * L1.income) (1 missing value generated) . gen npchicken = pchicken - (rho * L1.pchicken) (1 missing value generated) . gen nppork = ppork - (rho * L1.ppork) (1 missing value generated) . gen npbeef = pbeef - (rho * L1.pbeef) (1 missing value generated) . . * Are testing using iterated rho value . . regress nchicken nincome npchicken nppork npbeef Source | SS df MS Number of obs = 22 -------------+------------------------------ F( 4, 17) = 5.98 Model | 31.3866437 4 7.84666092 Prob > F = 0.0034 Residual | 22.3068865 17 1.3121698 R-squared = 0.5846 -------------+------------------------------ Adj R-squared = 0.4868 Total | 53.6935302 21 2.55683477 Root MSE = 1.1455 ------------------------------------------------------------------------------ nchicken | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- nincome | .0043226 .0027932 1.55 0.140 -.0015705 .0102157 npchicken | -.0629167 .094766 -0.66 0.516 -.2628554 .137022 nppork | -.0450417 .0423259 -1.06 0.302 -.1343415 .0442581 npbeef | .0635601 .0296948 2.14 0.047 .0009097 .1262106 _cons | 6.30057 .6085844 10.35 0.000 5.01657 7.584571 ------------------------------------------------------------------------------ . estat dwatson Durbin-Watson d-statistic( 5, 22) = 1.884424 . predict residnewtest, resid (1 missing value generated) . corrgram residnewtest -1 0 1 -1 0 1 LAG AC PAC Q Prob>Q [Autocorrelation] [Partial Autocor] ------------------------------------------------------------------------------- 1 0.0573 0.0573 .08264 0.7738 | | 2 -0.1717 -0.1748 .86096 0.6502 -| -| 3 -0.2985 -0.3291 3.3366 0.3426 --| --| 4 -0.1114 -0.2021 3.7006 0.4480 | -| 5 -0.0123 -0.1721 3.7053 0.5926 | -| 6 -0.0306 -0.2653 3.7362 0.7123 | --| 7 0.0939 -0.0810 4.0467 0.7744 | | 8 -0.1438 -0.5313 4.826 0.7760 -| ----| 9 0.1211 0.0273 5.4219 0.7961 | | . . * non linear setup . nl (chicken = ({b0}*(1-{rho}))+{rho}*L.chicken + /// > {b1}*(income -{rho}*L.income) + /// > {b2}*(pchicken-{rho}*L.pchicken) + /// > {b3}*(ppork -{rho}*L.ppork) + /// > {b4}*(pbeef -{rho}*L.pbeef) ) in 2/23 (obs = 22) Iteration 0: residual SS = 1419.014 Iteration 1: residual SS = 53.93988 Iteration 2: residual SS = 23.99469 Iteration 3: residual SS = 22.2532 Iteration 4: residual SS = 22.24806 Iteration 5: residual SS = 22.24762 Iteration 6: residual SS = 22.24758 Iteration 7: residual SS = 22.24757 Iteration 8: residual SS = 22.24757 Iteration 9: residual SS = 22.24757 Iteration 10: residual SS = 22.24757 Iteration 11: residual SS = 22.24757 Iteration 12: residual SS = 22.24757 Source | SS df MS -------------+------------------------------ Number of obs = 22 Model | 782.761972 5 156.552394 R-squared = 0.9724 Residual | 22.2475734 16 1.39047334 Adj R-squared = 0.9637 -------------+------------------------------ Root MSE = 1.179183 Total | 805.009545 21 38.3337879 Res. dev. = 62.67949 ------------------------------------------------------------------------------ chicken | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- /b0 | 37.31082 7.927255 4.71 0.000 20.50579 54.11585 /rho | .8508506 .1199248 7.09 0.000 .5966214 1.10508 /b1 | .0039989 .0030704 1.30 0.211 -.0025099 .0105078 /b2 | -.0667888 .1008548 -0.66 0.517 -.2805914 .1470138 /b3 | -.0438802 .0447251 -0.98 0.341 -.1386932 .0509328 /b4 | .0622495 .0336527 1.85 0.083 -.0090909 .13359 ------------------------------------------------------------------------------ Parameter b0 taken as constant term in model & ANOVA table . end of do-file