第五章非平稳时间序列分析的程序.doc_第1页
第五章非平稳时间序列分析的程序.doc_第2页
第五章非平稳时间序列分析的程序.doc_第3页
第五章非平稳时间序列分析的程序.doc_第4页
第五章非平稳时间序列分析的程序.doc_第5页
已阅读5页,还剩9页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

data a;input year sha;dif=dif(sha);cards;1964 971965 1301966 156.51967 135.21968 137.71969 180.51970 205.21971 1901972 188.61973 196.71974 180.31975 210.81976 1961977 2231978 238.21979 263.51980 292.61981 3171982 335.41983 3271984 321.91985 353.51986 397.81987 436.81988 465.71989 476.71990 462.61991 460.81992 501.81993 501.51994 489.51995 542.31996 512.21997 559.81998 5421999 567;proc gplot;plot sha*year dif*year;symbol v=star c=red i=join;run;data a;input year x;dif1=dif(x);dif2=dif(dif1);cards;1950 5.431951 6.191952 6.631953 7.181954 8.951955 10.141956 11.741957 12.61958 17.261959 21.071960 22.381961 241962 24.81963 26.131964 27.611965 29.951966 33.921967 33.211968 34.81969 37.161970 42.411971 49.441972 57.741973 67.271974 78.571975 91.711976 106.71977 119.931978 135.841979 155.491980 178.291981 199.141982 215.751983 232.631984 260.411985 321.121986 361.951987 408.071988 464.381989 511.321990 551.361991 606.111992 691.741993 817.581994 941.951995 10401996 1100.081997 1219.091998 1319.31999 1452.94;proc gplot;plot x*year dif1*year dif2*year;symbol v=star c=red i=join;run;data a;input milk;time=intnx(month,1jan1962d,_n_-1);format time year4.;dif1=dif(milk);dif1_12=dif12(dif1);cards;589 561 640 656 727 697 640 599568 577 553 582 600 566 653 673742 716 660 617 583 587 565 598628 618 688 705 770 736 678 639604 611 594 634 658 622 709 722782 756 702 653 615 621 602 635677 635 736 755 811 798 735 697661 667 645 688 713 667 762 784837 817 767 722 681 687 660 698717 696 775 796 858 826 783 740701 706 677 711 734 690 785 805871 845 801 764 725 723 690 734750 707 807 824 886 859 819 783740 747 711 751 804 756 860 878942 913 869 834 790 800 763 800826 799 890 900 961 935 894 855809 810 766 805 821 773 883 898957 924 881 837 784 791 760 802828 778 889 902 969 947 908 867815 812 773 813 834 782 892 903966 937 896 858 817 827 797 843;proc gplot;plot milk*time dif1*time dif1_12*time;symbol v=star c=red i=join;run;data a;x0=0;do t=-10 to 1000;rand=10*rannor(12345);x=x0+rand;x0=x;if t0 then output;end;proc gplot;plot x*t;symbol v=none c=black i=join;run;data a;x0=0;do t=-10 to 1000;rand=10*rannor(12345);x=x0+rand;x0=x;if t0 then output;end;proc gplot;plot x*t;symbol v=none c=black i=join;run;goptions vsize=7cm hsize=10cm;data na_in;t=_n_;time=intnx(year,1jan1952d,_n_-1);format time year4.;input agric indus cons trans commer;dif=dif(agric) ;keep time agric dif;cards;100 100 100 100 100101.6 133.6 138.1 12 133103.3 159.1 133.3 136 136.4111.5 169.1 152.4 140 137.5116.5 219.1 261.9 164 146.6120.1 244.5 242.9 176 146.6120.3 383.5 367 270.8 155.9100.6 501.5 388.6 356.5 170.383.6 541.4 394 383.6 164.184.7 315.9 129.5 221.1 130.188.7 267.4 161.9 171.5 117.798.9 300.7 205.1 176 120.8111.9 374.9 259 198.6 123.9122.9 477.7 286 261.7 128131.9 598.5 313 297.8 155.9134.2 504.3 296.8 239.2 164.1131.6 458.6 237.5 225.6 151.8132.2 622.3 323.8 284.3 179.6139.8 863 421 343 199.2142 979 468.3 370.8 201.2140.5 1043.5 452.5 389.3 208153.1 1134.3 457.8 412.5 224.5159.2 1128.9 484.1 394 220.6162.3 1297.3 542 444.9 220.6159.1 1249.2 568.3 426.4 214.8155.1 1434 578.8 491.3 242161.2 1679.1 573.5 546.9 296.4171.5 1814.7 584.1 560.8 316.8168.4 2012.7 757.7 584 318.8180.4 2046.8 770 607.2 379.4201.6 2170.1 806.9 681.3 397.5218.7 2383.7 954.3 755.5 449.1247 2738.8 1056.7 852.8 499.5253.7 3275.2 1310.6 1024.3 593.7261.4 3590.6 1540 1140.2 636.3273.2 4058.8 1744.8 1269.9 715279.4 4765 1884 1413.6 760.8;proc print;proc gplot;plot agric*time=1 dif*time=1;symbol1 c=red i=join v=square;proc arima;identify var=agric(1) stationarity=(adf) nlag=18;estimate q=1;forecast lead=10 id=time interval=year out=out;proc print data=out;proc gplot;where time=1jan1955d;plot agric*time=2 forecast*time=3 (l95 u95)*time=4/overlay;symbol2 c=black i=none v=star;symbol3 c=red i=join v=none;symbol4 c=green i=join v=none l=3 w=1;proc autoreg data=na_in;model agric=t/nlag=2 method=ml dwprob;output out=p p=a1 pm=a2 lcl=lcl ucl=ucl;proc gplot data=p;where time=1jan1955d;plot agric*time=2 a1*time=3 lcl*time=4 ucl*time=4/overlay;proc autoreg data=na_in;model agric=dif/LAGDEP=DIF nlag=1 method=ml noint;output out=p p=b1 pm=b2 lcl=lcl ucl=ucl;proc gplot data=p;where time=1jan1955d;plot agric*time=2 b1*time=3 lcl*time=4 ucl*time=4/overlay;run;goptions vsize=7cm hsize=10cm;data a;input year x;dif=dif(x);cards;1917 183.11918 183.91919 163.11920 179.51921 181.41922 173.41923 167.61924 177.41925 171.71926 170.11927 163.71928 151.91929 145.41930 1451931 138.91932 131.51933 125.71934 129.51935 129.61936 129.51937 132.21938 134.11939 132.11940 137.41941 148.11942 174.11943 174.71944 156.71945 143.31946 189.71947 2121948 200.41949 201.81950 200.71951 215.61952 222.51953 231.51954 237.91955 2441956 259.41957 268.81958 264.31959 264.51960 268.11961 2641962 252.81963 2401964 229.11965 204.81966 193.31967 1791968 178.11969 181.11970 165.61971 159.81972 136.11973 126.31974 123.31975 118.5;proc gplot;plot x*year dif*year;symbol c=black i=join v=square;proc arima;identify var=x(1);estimate p=(1 4) noint;forecast lead=5 id=year out=out;proc gplot data=out;plot x*year=1 forecast*year=2 l95*year=3 u95*year=3/overlay;symbol1 c=black i=none v=star;symbol2 c=red i=join v=none;symbol3 c=green i=join v=none;run;goptions vsize=7cm hsize=10cm;data a;input x;dif1_4=dif4(dif(x);time=intnx(quarter,1jan1962d,_n_-1);format time year4.;cards;1.1 0.5 0.4 0.7 1.6 0.6 0.5 0.71.3 0.6 0.5 0.7 1.2 0.5 0.4 0.60.9 0.5 0.5 1.1 2.9 2.1 1.7 22.7 1.3 0.9 1 1.6 0.6 0.5 0.71.1 0.5 0.5 0.6 1.2 0.7 0.7 11.5 1 0.9 1.1 1.5 1 1 1.62.6 2.1 2.3 3.6 5 4.5 4.5 4.95.7 4.3 4 4.4 5.2 4.3 4.2 4.55.2 4.1 3.9 4.1 4.8 3.5 3.4 3.54.2 3.4 3.6 4.3 5.5 4.8 5.4 6.58 7 7.4 8.5 10.1 8.9 8.8 910 8.7 8.8 8.9 10.4 8.9 8.9 910.2 8.6 8.4 8.4 9.9 8.5 8.6 8.79.8 8.6 8.4 8.2 8.8 7.6 7.5 7.68.1 7.1 6.9 6.6 6.8 6 6.2 6.2;proc gplot;plot x*time dif1_4*time;symbol c=black i=join v=star;proc arima;identify var=x(1,4);estimate p=2 noint;forecast lead=0 id=time out=out;proc gplot data=out;plot x*time=1 forecast*time=2 /overlay;symbol1 c=black i=none v=star;symbol2 c=red i=join v=none;run;data a;input x;dif1_12=dif12(dif(x);time=intnx(month,1jan1948d,_n_-1);format time year4.;cards;446 650 592 561 491 592 604 635 580510 553 554 628 708 629 724 820 8651007 1025 955 889 965 878 1103 1092 978823 827 928 838 720 756 658 838 684779 754 794 681 658 644 622 588 720670 746 616 646 678 552 560 578 514541 576 522 530 564 442 520 484 538454 404 424 432 458 556 506 633 7081013 1031 1101 1061 1048 1005 987 1006 1075854 1008 777 982 894 795 799 781 776761 839 842 811 843 753 848 756 848828 857 838 986 847 801 739 865 767941 846 768 709 798 831 833 798 806771 951 799 1156 1332 1276 1373 1325 13261314 1343 1225 1133 1075 1023 1266 1237 11801046 1010 1010 1046 985 971 1037 1026 9471097 1018 1054 978 955 1067 1132 1092 10191110 1262 1174 1391 1533 1479 1411 1370 14861451 1309 1316 1319 1233 1113 1363 1245 12051084 1048 1131 1138 1271 1244 1139 1205 10301300 1319 1198 1147 1140 1216 1200 1271 12541203 1272 1073 1375 1400 1322 1214 1096 11981132 1193 1163 1120 1164 966 1154 1306 11231033 940 1151 1013 1105 1011 963 1040 8381012 963 888 840 880 939 868 1001 956966 896 843 1180 1103 1044 972 897 11031056 1055 1287 1231 1076 929 1105 1127 988903 845 1020 994 1036 1050 977 956 8181031 1061 964 967 867 1058 987 1119 12021097 994 840 1086 1238 1264 1171 1206 13031393 1463 1601 1495 1561 1404 1705 1739 16671599 1516 1625 1629 1809 1831 1665 1659 14571707 1607 1616 1522 1585 1657 1717 1789 18141698 1481 1330 1646 1596 1496 1386 1302 15241547 1632 1668 1421 1475 1396 1706 1715 15861477 1500 1648 1745 1856 2067 1856 2104 20612809 2783 2748 2642 2628 2714 2699 2776 27952673 2558 2394 2784 2751 2521 2372 2202 24692686 2815 2831 2661 2590 2383 2670 2771 26282381 2224 2556 2512 2690 2726 2493 2544 22322494 2315 2217 2100 2116 2319 2491 2432 24702191 2241 2117 2370 2392 2255 2077 2047 22552233 2539 2394 2341 2231 2171 2487 2449 23002387 2474 2667 2791 2904 2737 2849 2723 26132950 2825 2717 2593 2703 2836 2938 2975 30643092 3063 2991;proc gplot;plot x*time dif1_12*time;symbol c=black i=join v=none;proc arima;identify var=x(1,12);estimate p=1 q=(1)(12) noint;forecast lead=0 id=time out=out;proc gplot data=out;plot x*time=1 forecast*time=2 /overlay;symbol1 c=black i=none v=dot h=0.2;symbol2 c=red i=join v=none;run;data a;input returns;dif=dif(returns);r2=dif*2;y=log(returns);dify=dif(y);time=intnx(month,1apr1963d,_n_-1);format time year4.;cards;0.00238 0.00238 0.00236 0.0025 0.00254 0.0026 0.00285 0.002810.00241 0.00288 0.00287 0.00292 0.00294 0.00273 0.00271 0.002820.00267 0.00273 0.00293 0.00285 0.00296 0.00281 0.00326 0.003210.00315 0.00319 0.00313 0.00313 0.00319 0.00313 0.0033 0.003190.00315 0.00355 0.0037 0.00371 0.00364 0.00381 0.00372 0.003680.00374 0.00389 0.00415 0.00389 0.00343 0.00377 0.00368 0.003640.00338 0.00283 0.00271 0.003 0.00309 0.00317 0.00343 0.003470.00355 0.0036 0.00398 0.00385 0.00389 0.00444 0.00453 0.004440.00432 0.00406 0.00432 0.00461 0.00398 0.005 0.00487 0.00470.00432 0.00508 0.00478 0.00508 0.00593 0.0055 0.00593 0.005420.0054 0.0054 0.00631 0.00534 0.00546 0.00542 0.00546 0.004950.005 0.00508 0.00483 0.00444 0.00377 0.00355 0.00338 0.002640.00283 0.00305 0.00338 0.00406;proc gplot;plot returns*time dif*time r2*time y*time dify*time;symbol c=black i=join v=none;proc arima;identify var=returns ;identify var=y(1);estimate p=0 q=0 noint;forecast lead=0 id=time out=out;data out;merge a out;by time;estimate=exp(y);proc gplot;plot returns*time=1 estimate*time=2 /overlay;symbol1 c=black i=none v=star h=0.5;symbol2 c=red i=join v=none;run;data a;input a;laga=lag(a);t=_n_;cards;143.1 140.3 139.4 140.7 139.6 140.4 141.2 140.9 141.3 141.7 142.8 144.7144.4 140.9 139.5 140.8 138.7 139 140 140.4 141.6 142.3 143.4 145.7145.7 142.8 141.8 143.5 141.8 142.4 142.8 142.7 144.3 145.7 147.6 150.5150.2 146.9 146 148 145.8 146.2 146.4 145.8 146.9 148.4 150.2 153.3153.6 150.1 149.3 151.5 149.3 151.4 151.3 150.9 152.5 154.4 156.7 159159.4 155.4 154.6 156.8 154.2 155.5 157.1 157 159.4 161.3 163.1 166.4166.9 161.9 161.5 164.2 160.3 162.2 163.5 162.8 165.6 168.2 169.9 174.4175.6 170.3 170.4 174.1 169.6 171.7 171 170 172.7 173.4 174.6 178.6178.4 173.4 174.6 176.6 174.1 177.4 179.1 179 181.7 183.9 185.7 190.3189 184.9 185.4 189.3 186.5 190.2 191.9 191.4 193.9 196.3 199.6 204.8205.9 199.3 199.8 203.6 199.4 202.3 203.3 201.5 203.2 205 207 211.4212.9 204 205.5 210.1 206.2 208.9 210.1 210 212.8 214.4 216.7 222.2222.6 216.6 218.6 223.7 221.1 225.2 227.5 225.9 227.7 229.1 231.2 236.9237.5 231.4 234.2 239.5 234.7 238.8 241.8 241.3 244.5 247 250.5 258.9259.4 251.2 251.6 257 253.6 259.3 261.1 258.6 259.5 261.4 265.6 273.3271.8 264.1 266.5 271.6 266.3 271.5 273.5 271 272.6 274.8 278.8 285.2281.8 273.3 276.4 281.4 278.1 286 288 286.3 287.8 288.5 293.5 299296.8 289 291.4 299.9 295.1 299.4 302.3 301 302.5 307 309.7 318.6317.7 309 312.2 322.7 315.6 321.7 326.3 324.3 327.7 332 335.4 344.1343.4 332 334.9 347.5 342.4 349.4 353.9 351.7 357 359.4 362.9 372.5367.8 356.4 360.8 376.2 367.1 376.7 383.3 381.9 385.6 387.7 389.8 398.6390.7 380.9 382.4 387.1 377.8 387.6 394.8 398.5 404.9 411 416.1 419.8416.5 405.7 412.5 431.3 418.6 423 427.9 426.1 427.3 429.8 435.2 447.2448.7 432.6 435.8 451.3 441.1 446.5 449.6 450 456.4 466 474.5 486483 474.2 482.9 498.7 494.1 503.7 510.7 508.5 511.5 517.4 522.1 533.4530.4 517.6 524.2 539.2 530.8 541.4 543.3 539 542.5 542.1 549.6 564.5561.1 551.9 558.3 575 569.4 585.2 592 594.8 602.2 605.5 615.1 633.5626.8 613.1 624.6 647.2 645.7 663.5 674 679.1 685.2 692.8 709.5 740.6737.5 717.1 723.5 752.5 739.9 744.4 746.8 745 745.2 753.7 756 765.9764.7 745 752.1 778.3 763.8 778.8 785.6 781.3 780 780.8 787.1 803.2793 772.3 775.2 791.3 767.2 773.8 781.7 777.4 778.5 784.5 791.4 811.9802.4 788.3 796.2 818 797.3 810.8 812.9 814.5 818.9 817.6 826.1 844.3833.2 823.4 835 852.9 841.9 857.8 861.9 864.2 867.3 875 893.4 916.8918.1 916.5;proc gplot;plot a*T;symbol v=none i=join c=black;proc autoreg;model a=laga/lagdep=laga nlag=2 garch=(p=1,q=1);output out=out p=forecast ;proc gplot;plot a*t=1 forecast*t=2 /overlay;symbol1 c=black v=star i=none h=0.1;symbol2 c=red v=none i=join;run;data example5_1;input x;difx=dif(x);t=_n_;cards;1.05 -0.84 -1.42 0.20 2.81 6.72 5.40 4.385.52 4.46 2.89 -0.43 -4.86 -8.54 -11.54 -16.22-19.41 -21.61 -22.51 -23.51 -24.49 -25.54 -24.06 -23.44-23.41 -24.17 -21.58 -19.00 -14.14 -12.69 -9.48 -10.29-9.88 -8.33 -4.67 -2.97 -2.91 -1.86 -1.91 -0.80;proc gplot;plot x*t difx*t;symbol v=star c=black i=join;proc arima;identify var=x(1);estimate p=1;forecast lead=5 id=t out=out;proc gplot data=out;plot x*t=1 forecast*t=2 l95*t=3 u95*t=3/overlay;symbol1 c=black i=none v=star;symbol2 c=red i=join v=none;symbol3 c=green I=join v=none;run;goptions vsize=7cm hsize=10cm;data example5_2;input x;lagx=lag(x);t=_n_;cards;3.03 8.46 10.22 9.80 11.96 2.838.43 13.77 16.18 16.84 19.57 13.2614.78 24.48 28.16 28.27 32.62 18.4425.25 38.36 43.70 44.46 50.66 33.0139.97 60.17 68.12 68.84 78.15 49.8462.23 91.49 103.20 104.53 118.18 77.8894.75 138.36 155.68 157.46 177.69 117.15;proc gplot data=example5_2;plot x*t=1;symbol1 c=black i=join v=star;proc autoreg data=example5_2;model x=t/ dwp

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论