时间序列Stata操作--题4-7[优质文档]

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

《应用时间序列分析(第四版)》王燕编著中国人民大学出版社第四章习题71974年1月至1994年12月,某地胡椒价格数据如下:(21行*12列)11021151109311181168111810851135113811351235130112831250121011351085106011021151112712261217121512501210126814021486153415671585171720022086205912501210126814021486153415671585171720022086205924252326217621212000200018501640170019251850183018501790170017001750177519252000197519401889188120002024190017501649160116251609164916401640162015901526145114241424132911991179128513491265129913731440145113761325126111991219125012741365142414201385132112351215131013191319127914811956216521252087189518401874186318361894210521592131202922702411265232943360368635933482361539634328430943364382432640094000407042004278443547724812490848574865471146404877490248844833490349634804467948104571425038503775335729462342199424202464276329933108272925252457213622722175210020681955195019692025172615791768176616211692163417501620151515081525150213741212119811071052106910501098115011261200119310581043102698097610001210126411501117118811001040102811131154135017221616152514031497152215501575153816501800193322192606256324331检验序列的平稳性(Stata语句).dropB-T.generaten=_n.renameAprice.tssetntimevariable:n,1to252delta:1unit.tslineprice=10002000300040005000price050100150200250n{price}的时序图由时序图观测得price变化落差很大,该序列不平稳...。再看看自相关图:(Stata语句).acprice=-1.00-0.500.000.501.00Autocorrelationsofprice010203040LagBartlett'sformulaforMA(q)95%confidencebands{price}的自相关图短期(延迟阶数为5期及5期以内)来看,自相关系数拖尾;长期来看,自相关系数缓慢地由正转负,一直是下降趋势。序列值之间长期相关,该序列非平稳序列。(Ps.平稳时间序列具有短期自相关性。)结合之前的时序图,发现该序列具有明显的长期趋势........。考虑到price是月度数据,因此觉得该序列很有可能还...存在季节效应......。2检验序列的方差齐性原序列具有长期趋势,所以需要平稳化。先对原序列做一阶差分:(Stata语句).generateDp=D1.price.labelvariableDpfirstdifferenceofprice.tslineDp=-1000-50005001000firstdifferenceofprice050100150200250n{Dp}的时序图(一阶)差分后序列{Dp}的长期趋势不再明显,平稳化效果很好。再看看{Dp}的自相关图:(Stata语句).acDp=-0.200.000.200.40AutocorrelationsofDp010203040LagBartlett'sformulaforMA(q)95%confidencebands{Dp}的自相关图由图可见,短期(5期)内便衰减直逼零值,衰减速度非常快,明显具有短期自相关性。在延迟1期以后,除了当k=30时跳出过阴影范围,其余全都落在2倍标准误的范围内,围绕着零值做很小幅(约±0.1)的波动。因此,{Dp}是平稳的时间序列。平稳性检验通过,看白噪声检验。自相关图明显显示:≠0,≠0。因此,{Dp}非白噪声序列,有信息待提取。预处理完毕,开始识别模型:(Stata语句)-0.200.000.200.40AutocorrelationsofDp010203040LagBartlett'sformulaforMA(q)95%confidencebands{Dp}的自相关图.pacDp=-0.200.000.200.40PartialautocorrelationsofDp010203040Lag95%Confidencebands[se=1/sqrt(n)]{Dp}的偏自相关图(1)不考虑季节效应,先试ARIMA模型,再试疏系数模型。①ARIMA模型ⅰ认为和都拖尾,尝试ARMA(1,1)或者arimaDp,arima(1,0,1)Ps.同arimaprice,arima(1,1,1)结果参数显著性检验通不过ⅱ认为1阶截尾,拖尾,尝试MA(1)去掉截距项再试(Stata语句)arimaDp,noconstantarima(0,0,1)Ps.结果同arimaprice,noconstantarima(0,1,1)得到结果白噪声检验(Stata语句).predictehat1,residual.wntestqehat1Portmanteautestforwhitenoise---------------------------------------Portmanteau(Q)statistic=45.3466Probchi2(40)=0.2589Ps..wntestqehat1,lags(2).wntestqehat1,lags(6).wntestqehat1,lags(12)都通过了.wntestbehat1=.estatic截距项不显著对{Dp}构建MA(1)模型(无截距项)成功,对残差项进行白噪声检验0.000.200.400.600.801.00Cumulativeperiodogramforehat10.000.100.200.300.400.50FrequencyBartlett's(B)statistic=0.70ProbB=0.7145CumulativePeriodogramWhite-NoiseTest通过了白噪声检验,但这个检验的前提是同方差残差项是白噪声序列,计算AIC/BIC:=ⅱ认为拖尾,1阶截尾,尝试AR(1)去掉截距项再试(Stata语句).arimaDp,noconstantarima(1,0,0)白噪声检验(Stata语句).predictehat2,residual.wntestqehat2Portmanteautestforwhitenoise---------------------------------------Portmanteau(Q)statistic=40.3516Probchi2(40)=0.4547Ps..wntestqehat2,lags(2).wntestqehat2,lags(6).wntestqehat2,lags(12)都通过了截距项不显著对{Dp}构建AR(1)模型(无截距项)成功,对残差项进行白噪声检验0.000.200.400.600.801.00Cumulativeperiodogramforehat20.000.100.200.300.400.50FrequencyBartlett's(B)statistic=0.67ProbB=0.7551CumulativePeriodogramWhite-NoiseTest.wntestbehat2=.estatic=通过了白噪声检验,但这个检验的前提是同方差BIC方面,与MA(1)比,大了3点多;AIC方面仅小了0.5多一点。选择MA(1)②疏系数模型因为前十二期(一年)内和明显跳出了2倍标准误范围,所以确定ma(1),ar(1),与上面①ⅰ对{Dp}拟合ARMA(1,1)的情况一致,已经知道拟合不成了。(2)换季节模型,先试简单的加法模型,再试复杂的乘积模型。因为考虑了季节因子,这里是月度数据,所以要对一阶差分后序列进行12步差分。观察12步差分后序列的自相关系数和偏自相关系数的性质,尝试拟合季节模型。(Stata语句).generateS12Dp=S12.Dp.labelvariableS12Dp12stepsofthedifference.acS12Dp=.pacS12Dp=-0.60-0.40-0.200.000.200.40AutocorrelationsofS12Dp010203040LagBartlett'sformulaforMA(q)95%confidencebands{S12Dp}的自相关图1期12期-0.60-0.40-0.200.000.200.40PartialautocorrelationsofS12Dp010203040Lag95%Confidencebands[se=1/sqrt(n)]{S12Dp}的偏自相关图①加法季节模型ⅰ1阶12阶截尾拖尾,结合疏系数模型,对序列{S12Dp}拟合MA(1,12)模型ⅱ拖尾1阶12阶(13阶)截尾,结合疏系数模型,对序列{S12Dp}拟合AR(1,12)或AR(1,12,13)模型ⅲ综合考虑和几阶截尾的性质(哪几期延迟期数对应的相关系数特别明显),对序列{S12Dp}拟合ARIMA((1,12)(1,12))模型ⅰ对序列{S12Dp}拟合MA(1,12)模型或者(Stata语句).arimaS12Dp,ma(1,12)=12期1期13期24期36期去掉截距项.arimaS12Dp,noconstantma(1,12)=.predictehat3,residual.wntestqehat3Portmanteautestforwhitenoise---------------------------------------Portmanteau(Q)statistic=62.1168Probchi2(40)=0.0141Q统计量的P值,拒绝原假设,认为残差列非纯随机,序列{S12Dp}中还有信息未提取完毕,建模失败ⅱ对序列{S12Dp}拟合AR(1,12)或AR(1,12,13)模型.arimaS12Dp,noconstantar(1,12).predictehat4,residual(13missingvaluesgenerated).wntestqehat4Portmanteautestforwhitenoise---------------------------------------Portmanteau(Q)statistic=68.0750Probchi2(40)=0.0037失败.arimaS12Dp,ar(1,12,13)在wntestq时也失败了ⅲ对序列{S12Dp}拟合ARIMA((1,12)(1,12))模型.arimaS12Dp,noconstantar(1,12)ma(1,12)在wntestq时也失败了序列{S12Dp}所

1 / 21
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功