使用holt预测返回10而不是100(包预测)

时间:2016-01-28 09:19:16

标签: r forecasting

我试图用holt的方法创建100天的预测。虽然我在h参数中指定(来自forecast.ets,包forecast手册)

  

h:预测的期数

library(forecast)    
test_holt<-holt(ts(for_stack),exponential=TRUE) # for_stach 
forecast_holt<-forecast(test_holt,h=100) # specifing horizon of 100! 
forecast_holt$mean 

只获得10的视野!

> forecast_holt$mean
Time Series:
Start = 157 
End = 166 
Frequency = 1 
 [1] 198.1574 194.7383 191.3782 188.0760 184.8308 181.6417 178.5075 175.4275 172.4005 169.4259

输入t.series:

for_stack <- c(1207.62834260185, 1502.97991236229, 1291.45089028721, 1351.6869272969, 
1381.7337386443, 1244.04910076058, 1285.61969637944, 1224.70540587755, 
993.218464987378, 1125.04197704554, 767.791463542128, 902.531518752993, 
1013.95661277622, 1111.62557328744, 853.080312916107, 826.696739320563, 
1048.69293285107, 870.696259541534, 1095.77677433032, 1078.64988512876, 
1079.91456251364, 1035.00248295658, 860.221118001323, 755.407252906719, 
695.650754933181, 826.9607841229, 896.208607058666, 710.568479153149, 
800.413788529405, 858.521991196837, 786.398095660058, 557.206703831091, 
740.603219482948, 872.126247912041, 762.490221685439, 674.553909515838, 
734.860165908694, 708.021418174972, 614.275906259982, 817.638187053168, 
744.744084724995, 809.05117226193, 670.079044990826, 590.411467182836, 
547.002537685287, 416.733752443948, 540.736666043736, 574.082635489142, 
864.751545646318, 736.263395243641, 785.659666231074, 465.989505527797, 
513.649367194719, 449.302075680436, 527.574028928579, 523.691443941223, 
537.007137198414, 409.808598619109, 395.087330301308, 401.329718497071, 
598.978902001252, 498.731681810835, 490.300653170811, 502.30687692024, 
580.124633628553, 522.919092786983, 521.060306277195, 510.208362073008, 
507.183508456421, 421.220132358007, 509.203497368113, 448.594564346262, 
392.10699324563, 357.918104688577, 308.053777985765, 546.118413106837, 
428.477086774952, 556.393514072948, 441.567612477025, 349.132315641052, 
353.238253843905, 346.131733839872, 390.025336821759, 430.961834439708, 
443.099183343883, 467.292471565885, 401.409095696245, 330.67712032898, 
312.484290139312, 400.483367233784, 363.682040208232, 316.092102984116, 
373.244101978165, 288.202906459333, 276.18982238145, 356.495312302512, 
497.973851533188, 424.739245410241, 408.236926446748, 376.970608131912, 
264.701147347265, 224.051653712285, 329.364338501346, 453.416516191486, 
413.468042166067, 570.16806229348, 445.797156039964, 419.64707285815, 
257.04175806869, 232.694155644366, 386.334880103774, 298.691240061209, 
308.283410626853, 347.410822694506, 234.597159290375, 218.787202875182, 
286.909030347816, 274.08504215959, 222.507229984656, 192.886180295808, 
284.323528746428, 132.602386057839, 238.727643240449, 202.927379321898, 
208.09500462368, 180.349730691522, 261.204540376373, 163.265569002904, 
140.184013537674, 216.48082464543, 277.986394704933, 234.60218606001, 
328.836758733129, 297.333482462622, 199.898071400634, 194.667111311805, 
242.740092238698, 193.71503224975, 294.580553713147, 273.066125072601, 
366.568356587479, 344.852041374821, 342.836193826982, 200.243502234397, 
270.930511221398, 202.618093803249, 316.072141714784, 292.457267262504, 
292.036375885156, 252.952243604226, 271.182175322184, 171.971471429647, 
361.909079963592, 303.360684074428, 241.172079047608, 29.5293539812633) 

1 个答案:

答案 0 :(得分:1)

holt本身就是一个预测函数,正如帮助文件所解释的那样。因此,您需要在holt的调用中指定您的视野。

test_holt <- holt(ts(for_stack),exponential=TRUE, h=100)