HoltWinters中的错误...未使用的参数(h =

时间:2015-04-20 16:33:44

标签: r forecasting

数据:

data <- c(13,15,13,15,18,44,22,20,35,25,22,26,24,
          26,38,25,32,47,17,23,49,19,22,44,14,18,37)
ts <- ts(data, frequency = 12, start = c(2013,1))

我想提前12个月预测HoltWinters

tsHolt <- HoltWinters(ts, seasonal = "additive")
tsHoltPredict <- HoltWinters(tsHolt, seasonal = "additive", h = 12)
plot(tsHoltPredict)

但我得到了:

  

HoltWinters错误(tsHolt,seasonal =“additive”,h = 12):     未使用的参数(h = 12)

2 个答案:

答案 0 :(得分:2)

predict()您要找的是什么?

tsHoltPredict <- predict(tsHolt, n.ahead = 12, prediction.interval = TRUE)

答案 1 :(得分:0)

重新阅读library(forecast)文档似乎:

forecast(tsHolt, 12)

也有效!