图1.3 序列difx模型拟合结果 根据检验结果显示,该序列延迟各阶的P值都大于显著性水平0.05,接受原假设,即股票的收盘价1阶差分序列为非白噪声序列。 图1.4预测结果 由上图可得,预测该股票下一天的收盘价为288.6812。 习题5 data example5_1; input x@@; difx=dif(x); t=_n_; cards; 2203 2360 2254 2165 2024 2078 2214 2292 2207 2119 2119 2137 2132 1955 1785 1747 1818 1909 1958 1892 1919 1853 1868 1991 2111 2119 1991 1859 1856 1924 1892 1916 1968 1928 1898 1850 16
1841 1824 1823 1843 1880 1968 2029 1996 1933 1805 1713 1726 1752 1795 1717 1648 1512 1338 1383 1344 1384 1484 1597 1686 1707 1640 1611 1632 1775 1850 1809 1653 1648 1665 1627 1791 ; 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=7 id=t; run; 实验结果: 图5.1序列时序图 由时序图可知该序列不平稳,即该序列为一个非平稳序列。 1阶差分序列时序图: 17
图5.2序列difx时序图 而差分运算能使用自回归方式提取确定性信息,因此对序列进行1阶差分运算,考察其1阶差分序列的平稳性。1阶差分序列值始终在0周围上下波动,即1阶差分序列平稳。 白噪声检验结果如下: 图5.3序列difx模型拟合结果 根据检验结果显示,该序列延迟各阶的P值都大于显著性水平0.05,接受原假设,即股票的收盘价1阶差分序列为非白噪声序列。 预测图: 18
图5.4预测结果
由上图可得,预测1939—1945年英国绵羊的数量分别为1851,1872,1879,1880,1879,1877,1875。
习题六
data example5_3; input x@@; t=_n_;
lagx=lag(x); cards;
4.99 5 5.03 5.03 5.25 5.26 5.3 5.45 5.49 5.52 5.7 5.68 5.65 5.8 6.5 6.45 6.48 6.45 6.35 6.4 6.43 6.43 6.44 6.45 6.48 6.4 6.35 6.4 6.3 6.32 6.35 6.13 5.7
5.58 5.18 5.18 5.17 5.15 5.21 5.23 5.05 4.65 4.65 4.6 4.67 4.69 4.68 4.62 4.63 4.9 5.44 5.56 6.04 6.06 6.06 8.07 8.07 8.1 8.05 8.06 8.07 8.06 8.11 8.6 10.8 11 11 11 9.48 9.18 8.62 8.3 8.47 8.44 8.44 8.46 8.49 8.54 8.54 8.5 8.44 8.49 8.4 8.46 8.5 8.5 8.47 8.47
8.47 8.48 8.48 8.54 8.56 8.39 8.89 9.91 9.89 9.91 9.91 9.9 9.88 9.86 9.86 9.74 9.42 9.27 9.26 8.99 8.83 8.83 8.83 8.82 8.83 8.83 8.79 8.79 8.69 8.66 8.67 8.72 8.77 9 9.61 9.7 9.94 9.94 9.94 9.95 9.94 9.96 9.97 10.83
10.75 11.2 11.4 11.54 11.5 11.34 11.5 11.5 11.58 12.42 12.85 13.1 13.12 13.1 13.15 13.1 13.2 14.2 14.75 14.6 14.6 14.45 14.5 14.8 15.85 16.2 16.5 16.4 16.4 16.35 16.1 13.7 13.5 14 12.3 12 14.35 14.6 12.5 12.75 13.7 13.45 13.55 12.6 12 11 11.6 12.05 12.35 12.7 12.45 12.55 12.2 12.1 11.15
11.85 12.1 12.5 12.9 12.5 13.2 13.65 13.65 13.5 13.45 13.35 14.45 14.3 15.05 15.55 15.65 14.65 14.15 13.3 12.65 12.7 12.8 14.5 15.1 15.15 14.3 14.25 14.05 14.7 15.05 14.05 13.8 13.25 13 12.85 12.6 11.8 13 12.35 11.45 11.35 11.55 10.85 10.9
12.3 11.7 12.05 12.3 12.9 13.05 13.3 13.85 14.65 15.05 15.15 14.85 15.7 15.4 15.1 14.8 15.8 15.8 15 14.4 13.8 14.3 14.15 14.45 14.1 14.05 13.75 13.3 13 12.55 12.25 11.85 11.5 11.1 11.15 10.7 10.25 10.55 10.25 10.3 9.6 8.4 8.2 7.25
19
8.35 8.25 8.3 7.4 7.15 6.35 5.65 7.4 7.2 7.05 7.1 6.85 6.5 6.25 5.95 5.65 5.85 5.45 5.3 5.2 5.55 5.15 5.4 5.35 5.1 5.8 6.35 6.5 6.95 8.05 7.85 7.75 8.6 ; proc gplot; plot x*t; symbol v=star c=black i=join; proc autoreg data=example5_3; model x=lagx/lagdep=lagx archtest; model x=lagx/lagdep=lagx noint garch=(p=1,q=1); output out=out p=xp; proc gplot data=out; plot x*t=2 xp*t=3/ overlay; symbol2 v=star i=none c=black; symbol3 v=none i=join c=red w=2; run; 实验结果; 得到序列时序图如下: z17161514131211109876540100200t300400 图6.1序列时序图 结果显示该序列不平稳。 20