gpt4 book ai didi

未找到预测包中的 R forecast.holtwinters

转载 作者:行者123 更新时间:2023-12-04 11:22:11 24 4
gpt4 key购买 nike

我正在尝试使用 forecast.holtwinters 函数,当我尝试运行它时:

dftimeseriesforecast <- forecast.HoltWinters(data, h=65)

我收到此错误:

Error: could not find function "forecast.HoltWinters"



我也试过这个:
 dftimeseriesforecast= forecast::forecast.HoltWinters(data, h=65)

但我收到此错误消息:

Error: 'forecast.HoltWinters' is not an exported object from 'namespace:forecast'



我使用以下代码查看预测包中的函数列表:
ls("package:forecast")

这将返回:

[1] "%>%" "accuracy" "Acf" "arfima" "Arima" "arima.errors" "arimaorder" "auto.arima"
[9] "autolayer" "baggedETS" "bats" "bizdays" "bld.mbb.bootstrap" "BoxCox" "BoxCox.lambda" "Ccf"
[17] "checkresiduals" "croston" "CV" "CVar" "dm.test" "dshw" "easter" "ets"
[25] "findfrequency" "forecast" "forecast.ets" "fourier" "fourierf" "gas" "geom_forecast" "GeomForecast"
[33] "getResponse" "ggAcf" "ggCcf" "gghistogram" "gglagchull" "gglagplot" "ggmonthplot" "ggPacf"
[41] "ggseasonplot" "ggsubseriesplot" "ggtaperedacf" "ggtaperedpacf" "ggtsdisplay" "gold" "holt" "hw"
[49] "InvBoxCox" "is.acf" "is.Arima" "is.baggedETS" "is.bats" "is.constant" "is.ets" "is.forecast"
[57] "is.mforecast" "is.nnetar" "is.nnetarmodels" "is.splineforecast" "is.stlm" "ma" "meanf" "monthdays"
[65] "msts" "na.interp" "naive" "ndiffs" "nnetar" "nsdiffs" "Pacf" "remainder"
[73] "rwf" "seasadj" "seasonal" "seasonaldummy" "seasonaldummyf" "seasonplot" "ses" "sindexf"
[81] "snaive" "splinef" "StatForecast" "stlf" "stlm" "taperedacf" "taperedpacf" "taylor"
[89] "tbats" "tbats.components" "thetaf" "trendcycle" "tsclean" "tsCV" "tsdisplay" "tslm"
[97] "tsoutliers" "wineind" "woolyrnq"



有谁知道发生了什么?我以前用过这个,没有任何问题。我正在使用预测版本 8.1。

最佳答案

这些东西都不在 forecast 中包裹。他们在 stats :

> m <- stats::HoltWinters(co2)
> class(m)
[1] "HoltWinters"
> p = predict(m)
> pp = stats:::predict.HoltWinters(m)
> p
Jan
1998 365.1079
> pp
Jan
1998 365.1079
predict.HoltWinters是来自 stats 的未导出函数应该只在来自 HoltWinters() 的对象上调用.
forecast.HoltWinters是来自 forecast 的未导出函数这意味着您需要三个冒号才能访问它。但是你永远不应该这样做,因为当你运行 forecast 时它应该会被自动找到。在 HoltWinters() 的输出上:
> m <- stats::HoltWinters(co2)
> forecast(m)
Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
Jan 1998 365.1079 364.7139 365.5019 364.5053 365.7105
Feb 1998 365.9664 365.5228 366.4100 365.2879 366.6449
[etc]

与...一样:
> forecast:::forecast.HoltWinters(m)
Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
Jan 1998 365.1079 364.7139 365.5019 364.5053 365.7105
Feb 1998 365.9664 365.5228 366.4100 365.2879 366.6449
[etc]

关于未找到预测包中的 R forecast.holtwinters,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45374807/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com