简体   繁体   English

霍特温特人在R 3.4.3中进行了预测?

[英]Where did the forecast.Holtwinters go in R 3.4.3?

I'm using R Studio based on R 3.4.3. 我正在使用基于R 3.4.3的R Studio。 However, when I tried to call the forecast.HoltWinters function, R told me that "could not find function "forecast.HoltWinters"". 但是,当我尝试调用Forecast.HoltWinters函数时,R告诉我“找不到函数“ forecast.HoltWinters””。 Inspect the installed package (v8.2) told me that it's true, there is no forecast.HoltWinters. 检查安装的软件包(v8.2)告诉我这是真的,没有任何预测。HoltWinters。 But the manual in https://cran.r-project.org/web/packages/forecast/ clearly stated that forecast.HoltWinters is still available. 但是https://cran.r-project.org/web/packages/forecast/中的手册清楚地表明Forecast.HoltWinters仍然可用。

I have also tried stats::HoldWinters, but it's working wrong. 我也尝试过stats :: HoldWinters,但是工作不正确。 The code run fine on another computer, but it couldn't run at all on mine. 该代码可以在另一台计算机上正常运行,但根本无法在我的计算机上运行。 Is there any solution? 有什么解决办法吗?

Here is the code. 这是代码。 Book2.csv has enough data to last more than 3 periods. 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

Fit a HoltWinters model using the HoltWinters function and then use forecast . 使用HoltWinters函数拟合HoltWinters模型,然后使用forecast Its all in the help for HoltWinters and forecast , namely "The function invokes particular _methods_ which depend on the class of the first argument" . 一切都对HoltWintersforecast有所帮助,即"The function invokes particular _methods_ which depend on the class of the first argument" I'll copy the guts of it here: 我将在此处复制其内容:

m <- HoltWinters(co2)
forecast(m)

Note this will call the non-exported forecast.HoltWinters function, which you should never call directly using triple-colon notation as some may suggest. 请注意,这将调用非出口forecast.HoltWinters功能,你永远不应该使用三冒号符号因为有些人可能认为直接调用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM