forecast.Holtwinters 在 R 3.4.3 中去了哪里?

Where did the forecast.Holtwinters go in R 3.4.3?

我正在使用基于 R 3.4.3 的 R Studio。但是,当我尝试调用 forecast.HoltWinters 函数时,R 告诉我 "could not find function "forecast.HoltWinters""。检查安装包(v8.2)告诉我是真的,没有forecast.HoltWinters。但是https://cran.r-project.org/web/packages/forecast/里面的说明书明明说forecast.HoltWinters还是可以的

我也试过 stats::HoldWinters,但它工作不正常。代码 运行 在另一台计算机上正常,但在我的计算机上根本无法 运行。有什么解决办法吗?

这是代码。 Book2.csv 有足够的数据持续超过 3 个周期。

dltt <- read.csv("book2.csv", header = TRUE)
dltt.ts <- ts(dltt$Total, frequency=12, start=c(2014,4))
dltt.ts.hw <- HoltWinters(dltt.ts)
library(forecast)
dltt.ts.hw.fc <- forecast.HoltWinters(dltt.ts.hw) //Error as soon as I run this line

使用 HoltWinters 函数拟合 HoltWinters 模型,然后使用 forecast。全部在 HoltWintersforecast 的帮助中,即 "The function invokes particular _methods_ which depend on the class of the first argument"。我会在这里复制它的内容:

m <- HoltWinters(co2)
forecast(m)

请注意,这将调用 non-exported forecast.HoltWinters 函数,您应该 永远不要 直接使用 triple-colon 表示法调用该函数,有些人可能会建议这样做。