《应用时间序列分析实验某欧洲小镇1963年1月至1976年12月每月旅馆入住的房间数.docx》由会员分享,可在线阅读,更多相关《应用时间序列分析实验某欧洲小镇1963年1月至1976年12月每月旅馆入住的房间数.docx(10页珍藏版)》请在课桌文档上搜索。
1、应用时间序列分析实验作业班级:姓名:学号:.习题6.9某欧洲小镇1963年1月至1976年12月每月旅馆入住的房间数如表6-10所示(行数据)(1)考察该小镇旅馆入住情况的规律;(2)根据该序列呈现的规律,你能想出多少种方法拟合该序列?比较不同方法的拟合效果:(3)选择拟合效果最好的模型,预测该序列未来3年的旅馆入住怙况:R程序I1.ibrary(readx1.)SetWdrD:/C1。UdMUSiC/大三实验报告/时间序列”)sy69-readexce1.(,s)69.x1.sx*)1.ibrary(tseries)hote1.-ts(sy6_9,start=c(1963,1),freque
2、ncy=12)* 绘制时序图p1.ot(hote1.,co1=4,main=旅馆入住的时序图”)* 进行1阶12步差分,绘制差分后时序图y-t1.iff(diff(hote1.,12)p1.ot(y)升差分后序列平稳性检验1.ibrary(aTSA)adf.1.est(y)升差分后序列纯I机性检验for(kin1:2)print(Box.1.est(y,1.ag=6,1.ype=*1.jung-Box-)力计算自相关系数图,偏自相关系数图acf(y,1.ag=36)IWicf(y,Iag=36)* 拟合加法ARIMA模型X.fit-arima(hote1,order=c(4,1,0),seas
3、ona1.=Iist(order=c(0,1,0),poriod=4),transform.pars=F,fiXCd=c(NA,0,0,NA)x.fit升模型显著性检验ts.diag(x.fit)#三年期预测1.ibrary(forecast)x.fore-forecast:forecast(x.fit,h-36)x.fore#绘制预测效果图p1.ot(x.fore,1.ty=2)1.ines(fi1.1.ed(x.fit),co1.=2)升拟合季度乘法模型x.fi1.1.-arin(hote1.,order=c(1.,1,1),seasona1.1.ist(order=c(0,1,1),pe
4、riod=12)x.fit1.#拟合模型显著性检验ts.diag(x.fit1.)#模型预测,并绘制预测效果图Iibrary(forecast)x.fore1.adf.test(y)AUgmentedDickey-Fu1.1.erTesta1.ternative:stationaryype1:rodriftnotrend1.agADFp.va1.ue1,0-19.610.012.1-11.010.013,2-10.630.014,3-9.070.015,4-10.600.01Type2:Vdthdriftnotrend1.agADFp.VaIUe1,0-19.560.012,1-10.980.
5、013,2-10.600.014,3-9.040.015,4-10.560.01Type3:withdriftandtrend1.agADFp.va1.ue1.0-19.50.012.1-10.90.013,2-IO.60.014,3-9.00.015,4-10.50.01Note:infact.p.va1.ue!三0.01meansp.va1.ue参差分后序列纯的机件检验for(kin1:2)+print(Box.test(y,1.ag=6,type=H1.jung-BoxH)Box-1.jungtestdata:yX-squaredS7.422,df6vp-va1.ue1.Se-IOBox
6、-1.jungtestdata:yX-squared=57.422.df=6vp-va1.ue=1.Se-IOca1.1.:ariM(xhote1.orderc(4.1.0).seasona1.1.ist(order;transfor.pars-F.fixed-c(n,0.0,na)Bc(0,1.0).period-4),ICoefficients:ar1.ar2ar3ar40.216S00-0.4790s.e.0.0G60000.0671si9ra2estiaatedas11802:1.og1.ike1.ihood-M6.02,aic1998.04x.forePointForecast1.O
7、80Hi801.O9SHi95Jan1977760.2206620.99812899.443547.29822973.1429Feb1977835.0482615.809791054.287499.752001170.3444war1977885.74736O4.G77431.1.81745S.888021315.6066Apr1977984.S556652.239711316.871476.322331492.7888May1977797.S831381.6492S1213.517161.467181433.6990Jun1977817.5410331.S00021303.58274.205
8、4S1560.8766Ju1.1977785.1344239.192821331.076-49.8H181620.0799Aug1977873.7091274.352381473.066-42.927891790.3460Sep1977718.144623.375601412.914-344.412871780.7020Oct1977771.1844-17.S1O421559.879-43S.020231977.3890Nov1977785.747389.446091660.941-552.745512124.2402Dec1977889.3913-65.26B01844.044-570.62
9、3882349.4066Jan1978722.0441342.S24861786.613-906.0716223S0.1618Feb1978756.6868-411.118891924.492-1029.317882542.691Swar1978744.7685-S17.4880S2007.025-1185.68629267S.2232Apr1978835.4618-514.249692185.173-1228.7431.2899.6674May1978670.9552-795.703062137.614-1572.1OSO62914.0155Jun197871S.O2538660005222
10、96.OS1-1702.945033132.9956Ju1.1978717.8324-971.245152406.910-1865.388823301.0537Aug1978817.9169973.176262609.010-1921.323683S57.1574Sep1978654.0824-126S.109952573.275-2281.069023589.2338Oct1978693.7822-1349.689472737.254-2431.438003819.0023Nov1978688.S896-1472.265152849.444-2616.152S73993.3319Dc1978
11、782.4440-1489.S77163054.465-2692.312494257.200SJan1979616.9390-1790.578613024.457-306S.041444298.9194Feb1979658.3705-1882.001543198.743-3226.793274543.S343Mar1979657.3848-2010.078103324.848-3422.147664736.9173APr19797SS.1340-2033.882363S44.150-3S10.29847S020.5666May1979591.2724-2342.027273524.572-38
12、94.822305077.3670Jun1979632.2301-2442.S90183707.050-4070.30170S334.7619Ju1.1979629.1267-2581.435543839.689-4281.004S4SS39.2580Aug1979724.5518-2616.223374065.327-4384.722945833.8266SeP1979559.3999-2932.943014051.743-4781.67768S900.4775Oct19796.3O53-3041.213064241.824-4968.916436169.5270NOV1979598.205
13、0-3187.229024383.639-5191.116746387.5267Dec1979694.9605-3229.251504619.173-5306.603866696.5249ForecastsfromARIMA(4,1,0)(0,1,0)(4-1965197019751980.fi1.ca1.1.:ariaA(-hote1.orderc(1.1.a1)vseasona1.-1.ist(ordcr-c(0t1.1).period-12)Coefficients:ar1.M1.S!M10.1861-1.000-0.4056s.e.0.08230.0180.0706sigaa2esti
14、matedas247.6:1.og1.ike1.ihood-6S0.99.ac-1109.98x.fore1.PointJ1.bryn19PJa11FeMaAPMaJU3uAUse777777777777888888888888777777777777777777777777999999999999999999999999Forecast829.5849764.6243776.48S6867.6928852.7093966.07741129.58841152.6823891.0211891.7186780.7046886.41S38SO.5O19787.6820799.9418891.2231
15、876.2S34989.62411153.13561176.2296914.5684915.2659804.2S191.o80809.3465744.0121755.8557847.0614832.0776945.44571108.95671132.0506870.3894871.0869760.0728865.7836826.5309763.5824775.8338867.1141852.144296S.S1491129.026411S2.12O4890.4592891.1567780.1427849.8233785.2366797.11S6888.3243873.3409986.70911
16、150.22021173.3140911.6529912.3S04801.3363907.0471874.4728811.7816824.0497915.3321900.36251013.73331177.24481200.3388938.6776939.37S1828.36111.o95798.6329733.1006744.9B48836.1397821.1SS8934.52391098.0M91121.1288859.467686O.16S1749.15118S4.8618813.8415750.8249763.0718854.3516839.3816952.7S231116.26371
17、139.3577877.6965878.3941767.3800Hi95860.5369796.148080.0364899.24S9884.2627997.63091161.14191184.2358922.S746923.2722812.2581917.9689887.1622824.S391836.8117928.0947913.12S21026.49S91190.741213.1014951.4402952.1377841.1237brryn1.9ptvcJar1FeMaAPMa3uJUAUseocNODeR999999999997777777777799999999999911111
18、1111111874.0491811.2293823.4890914.7704899.80061013.17141176.68281199.7768938.11S6938.8132827.7991933.SO99846.980S784.0380796.2887887.5689872.598998S.96961149.48111172.5751910.9139911.6114800.5974906.3081901.1178838.420S850.6893941.9719927.00231040.37311203.88461226.9786965.3174966.01498SS.0009960.7
19、116832.6S12769G439781.3898873.1693858.1992971.S699113S.08141158.1753896.5142897.2117786.1976891.9084915.44708S2.8147865.08839S6.3715941.402110S4.77281218.28431241.3783979.7171980.4147869.46975.1114ForecastsfromARIMA(1.1,i,1,1)12结论I1 .由时序图可知,该序列既含有长期递增趋势,又含有以年为周期的季节效应,对原序列进行1阶差分提取趋势效应,再作12步差分消除季节效应的影
20、响,1阶12步差分后时序图显示差分后序列没有明显趋势和周期特征了,ADF检验显示差分后序列平程,白噪声检验显示差分后序列为非白噪声序列。2 .考察差分后的自相关图和偏自相关图的性质,为拟定模型定阶。自相关图显示延迟24阶后的自相关系数显著大于2倍标准差,这说明差分后序列种仍然蕴含非常显著的季节效应,延迟1阶,2阶的自相关系数也大于2倍标准差,这说明差分后的序列还具有短期相关性,观察偏自相关图得到的结论和自相关图的结论一致。3 .根据差分后序列的自相关图和偏自相关图的性质可知,尝试拟合各种ARMA模型,拟合效果不理想,拟合残差均通不过白噪声检验,说明简单的季节加法模型并不适合这个模型,所以尝试使用季节乘法模型来拟合该序列。4 .综合前面的差分信息,我们要拟合的乘积模型为AR1.MA(1,1,1)*(0,1,D12,使用条件最小二乘与极大似然混合估计方法,得到该模型拟合口径如下:VVxt-1000(1.04056B,)tVar=247.61-0.18615 .对拟合模型进行检验,检验结果显示残差为白噪声序列,系数均显著为非零,这说明该模型拟合良好,对序列相关信息的提取充分。6 .最后,将序列拟合值和观察值联合作图。通过图示也可以直观地看出来该乘法ARIMA模型对序列的拟合效果良好。