《时间序列分析》习题解答�0�2习题2.3�0�21考虑时间序列12345…201判断该时间序列是否平稳2计算该序列的样本自相关系数kρ∧k12… 6 3绘制该样本自相关图并解释该图形. �0�2解1根据时序图可以看出该时间序列有明显的递增趋势所以它一定不是平稳序列�0�2即可判断该时间序是非平稳序列其时序图程序见后。
�0�2 时间序描述程序data example1 input number timeintnxyear01jan1980d _n_-1 format time date. cards 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 proc gplot dataexample1 plot numbertime1 symbol1 cblack vstar ijoin run�0�2�0�2�0�22当延迟期数即k本题取值1 2 3 4 5 6远小于样本容量n本题为20时自相关系数kρ∧计算公式为number1234567891011121314151617181920time01JAN8001J AN8101JAN8201JAN8301JAN8401JAN8501JAN8601JAN870 1JAN8801JAN8901JAN9001JAN9101JAN9201JAN9301JAN9 401JAN9501JAN9601JAN9701JAN9801JAN99121nkttktknttX XXXXXρ�6�1∧�6�1�6�1≈�6�1∑∑ 0kn4.9895�0�2注20.05125.226χ接受原假设认为该序列为纯随机序列。
�0�2解法三、Q统计量法计算Q统计量即12214.57kkQnρ∑�0�2�0�2�0�2�0�2�0�2�0�2�0�2�0�2�0�2�0�2查表得210.051221.0261χ�6�1由于Q统计量值4.57Q小于查表临界值即可认为接受原假设即该序列可视为纯随机序列为白噪声序列 5表2——9数据是某公司在2000——2003年期间每月的销售量。
表2——9 月份2000年2001年2002年2003年1 153134145117 2 187175203178 3 234243189149 4 212227214178 5 300298295248 6 221256220202 7 201237231162 8 175165174135 9 123124119120 10 1041068596 11 85876790 12 78747563 1绘制该序列时序图及样本自相关图。
2判断该序列的平稳性。
3判断该序列的纯随机性。
解1序列的时序图data example2_5 input sales timeintnxmonth01jan2000d_n_-1 format time monyy7. cards 153 187 234 212 300 221 201 175 123 104 85 78 134 175 243 227 298 256 237 165 124 106 87 74 145 203 189 214 295 220 231 174 119 85 67 75 117 178 149 178 248 202 162 135 120 96 90 63 proc print dataexample2_5 proc gplot dataexample2_5 plot salestime1 symbol1 cgreen vdiamond ijoin proc arima dataexample2_5 identify varsales run 样本自相关图sales010*******timeJAN2000APR2000JUL2000OCT2000JA N2001APR2001JUL2001OCT2001JAN2002APR2002JUL2002 OCT2002JAN2003APR2003JUL2003OCT2003JAN20042由时序图和样本自相关图的性质可以认为该序列平稳。
样本自相关图显示延迟3阶之后自相关系数由正接近于零并变为负延迟8阶之后又由负变为正这是具有周期变化规律的非平衡序列。
3有如下白噪声检验的结果由检验结果看出在各阶段延迟下LB检验统计量的P值都非常小为99.999该序列为非纯随机序列。
另解 data exmaple2_1 input s2000 s2001 s2002 s2003 timeintnxmonth01jan2000d _n_-1 format time date. cards 153 134 145 117 187 175 203 178 234 243 189 149 212 227 214 178 300 298 295 248 221 256 220 202 201 237 231 162 175 165 174 135 123 124 119 120 104 106 85 96 85 87 67 90 78 74 75 63 proc gplot dateexmaple2_1 plot s2000time1 s2001time2s2002time3 s2003time4/overlay symbol1 cred vsquare ispline symbol2 cblack vsquare ispline symbol3 cblue vsquare ispline symbol4 cyellow vsquare ispline run 运行结果时序图�0�2�0�2时序图显示该序列具有周期性所以不是平稳序列.�0�2 6、1969年一月至1973年9月在芝加哥海德公园内每28天发生的抢包案件数见表10 15 10 10 12 10 14 18 3 9 11 10 33 33 12 19 16 19 26 21 17 19 13 20 9 11 17 12 8 14 16 8 8 7 12 6 1判断该序列tx的平稳性及纯随机性2对该序列进行函数运算1�6�1�6�1tttxxy并判断序列ty 的平稳性及纯随机性. 解1时序图date�0�2example1�0�2input�0�2number�0�2timeintnx‘28’’01jan1969’d�0�2_n_‐1�0�2format�0�2time�0�2date.�0�2cards�0�210 15 10 10 12 10 7 7 10 14 8 17 14 18 3 9 11 10 6 12 14 10 25 29 33 33 12 19 16 19 19 12 34 15 36 29 26 21 17 19 13 20 24 12 6 14 6 12 9 11 17 12 8 14 14 12 5 8 10 3 16 8 8 7 12 6 10 8 10 5�0�2Proc�0�2gplot�0�2dateexample1�0�2Plot�0�2num bertime1�0�2symbol1�0�2cblack�0�2vstar�0�2ijoin�0�2run�0�2 时序图显示每28天抢包案件次数始终围绕10次附近随机波动没有明显趋势或周期基本可以视为平稳序列。
data example2_6 input casetimeintnx28days01jan1969d_n_-1 format time date. cards 10 15 10 10 12 10 7 7 10 14 8 17 14 18 3 9 11 10 6 12 14 10 25 29 33 33 12 19 16 19 19 12 34 15 36 29 26 21 17 19 13 20 24 12 6 14 6 12 9 11 17 12 8 14 14 12 5 8 10 3 16 8 8 7 12 6 10 8 10 5 proc print dataexample2_6 proc gplot dataexample2_6 plot casetime1 symbol1 cblack vdiamond ijoin proc arima dataexample2_6 number010203040time01SEP6801JAN6901MAY6901SEP6901 JAN7001MAY7001SEP7001JAN7101MAY7101SEP7101JAN 7201MAY7201SEP7201JAN7301MAY7301SEP7301JAN7401 MAY74identify varcase run 1由上图可知自相关系数长期位于零轴的一边且自相关系数递减到零的速度较慢在5个延期中自相关系数一直为正说明这是一个有典型单调趋势的非平稳序列。
与前矛盾�0�2�0�2根据以上LB统计量的检验判断该序列为非纯随机序列。
�0�22date�0�2example1�0�2input�0�2number�0�2 timeintnx‘28’’01jan1969’d�0�2_n_‐1�0�2format�0�2tim e�0�2date.�0�2cards�0�25�0�2‐5�0�20�0�22�0�2‐2�0�2‐3�0�20�0�23�0�24�0�2‐6�0�29�0�2‐3�0�24�0�2‐15�0�26�0�22�0�2‐1�0�2‐4�0�26�0�22�0�2‐4�0�215�0�24�0�24�0�20�0�2‐21�0�27�0�2‐3�0�23�0�20�0�2‐7�0�222�0�2‐19�0�2 21�0�2‐7�0�2‐3�0�2‐5�0�2‐4�0�22�0�2‐6�0�27�0�24�0�2‐12�0�2‐6�0�28�0�2‐8�0�26�0�2‐3�0�22�0�26�0�2‐5�0�2‐4�0�26�0�20�0�2‐2�0�2‐7�0�23�0�22�0�2‐7�0�213�0�2‐8�0�20�0�2‐1�0�25�0�2‐6�0�24�0�2‐2�0�22�0�2‐5�0�2�0�2�0�2Proc�0�2gplot�0�2dateexample1�0�2Pl ot�0�2numbertime1�0�2symbol1�0�2cblack�0�2vstar�0�2ijoin�0�2run�0�2�0�2�0�2有时序图可知该序列大致在0次左右波动基本平稳。
为了稳妥继续进行自相关图检验。
初步可认为平稳序列�0�2date�0�2example1�0�2input�0�2number�0�2timei ntnx‘28’’01jan1969’_n_‐1�0�2format�0�2time�0�2mony y5.�0�2cards�0�25�0�2‐5�0�20�0�22�0�2‐2�0�2‐3�0�20�0�23�0�24�0�2‐6�0�29�0�2‐3�0�24�0�2‐15�0�26�0�22�0�2‐1�0�2‐4�0�26�0�22�0�2‐4�0�215�0�24�0�24�0�20�0�2‐21�0�27�0�2‐3�0�23�0�20�0�2‐7�0�222�0�2‐19�0�221�0�2‐7�0�2‐3�0�2‐5�0�2‐4�0�22�0�2‐6�0�27�0�24�0�2‐12�0�2‐6�0�28�0�2‐8�0�26�0�2‐3�0�22�0�26�0�2‐5�0�2‐4�0�26�0�20�0�2‐2�0�2‐7�0�23�0�22�0�2‐7�0�213�0�2‐8�0�20�0�2‐1�0�25�0�2‐6�0�24�0�2‐2�0�22�0�2‐5�0�2�0�2�0�2Proc�0�2arima�0�2dateexample1�0�2Identify�0�2varnumber�0�2Run�0�2�0�2number-30-20-100102030ti me01SEP6801JAN6901MAY6901SEP6901JAN7001MAY700 1SEP7001JAN7101MAY7101SEP7101JAN7201MAY7201SE P7201JAN7301MAY7301SEP7301JAN7401MAY74�0�2自相关图显示:该序列自相关系数基本都在零值附近以一个很小的幅度做随机波动因此认为它是平稳的即可认为是平稳序列。