《应用时间序列分析实验某欧洲小镇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.2050-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