forecastHybrid 包的 hybridModel 中无法识别 ts 对象
ts object not recognised in hybridModel of forecastHybrid package
数据是这样的:
df <- tribble(
~y,~timestamp
18.74682, 1500256800,
19.00424, 1500260400,
18.86993, 1500264000,
18.74960, 1500267600,
18.99854, 1500271200,
18.85443, 1500274800,
18.78031, 1500278400,
18.97948, 1500282000,
18.86576, 1500285600,
18.55633, 1500289200,
18.79052, 1500292800,
18.74790, 1500296400,
18.62743, 1500300000,
19.04696, 1500303600,
18.97851, 1500307200,
18.70956, 1500310800,
18.92302, 1500314400,
18.91465, 1500318000,
18.61556, 1500321600,
19.03535, 1500325200 )
我正在尝试将 hybridModel 应用于时间序列数据以执行 ensemble.Below 是我的代码:
library(tidyquant)
library(forecast)
library(timetk)
library(sweep)
library(forecastHybrid)
df <- mutate(df, timestamp = as_datetime(timestamp))
tk_ts_df <- tk_ts(df, start = 1, freq = 3600, silent = TRUE)
fit <- hybridModel(tk_ts_df)
将时间序列对象 tk_ts_df(ts 对象)拟合到 hybridModel;它给出错误:"The time series must be numeric and may not be a matrix or dataframe object."
但是 link:https://cran.r-project.org/web/packages/forecastHybrid/vignettes/forecastHybrid.html
明确提到:该包的主力函数是 hybridModel(),该函数结合了“forecast”包中的多个组件模型。至少,用户必须为 y
提供一个 ts 或数字向量
请指出我做错了什么。
数据是这样的:
df <- tribble(
~y,~timestamp
18.74682, 1500256800,
19.00424, 1500260400,
18.86993, 1500264000,
18.74960, 1500267600,
18.99854, 1500271200,
18.85443, 1500274800,
18.78031, 1500278400,
18.97948, 1500282000,
18.86576, 1500285600,
18.55633, 1500289200,
18.79052, 1500292800,
18.74790, 1500296400,
18.62743, 1500300000,
19.04696, 1500303600,
18.97851, 1500307200,
18.70956, 1500310800,
18.92302, 1500314400,
18.91465, 1500318000,
18.61556, 1500321600,
19.03535, 1500325200 )
我正在尝试将 hybridModel 应用于时间序列数据以执行 ensemble.Below 是我的代码:
library(tidyquant)
library(forecast)
library(timetk)
library(sweep)
library(forecastHybrid)
df <- mutate(df, timestamp = as_datetime(timestamp))
tk_ts_df <- tk_ts(df, start = 1, freq = 3600, silent = TRUE)
fit <- hybridModel(tk_ts_df)
将时间序列对象 tk_ts_df(ts 对象)拟合到 hybridModel;它给出错误:"The time series must be numeric and may not be a matrix or dataframe object."
但是 link:https://cran.r-project.org/web/packages/forecastHybrid/vignettes/forecastHybrid.html
明确提到:该包的主力函数是 hybridModel(),该函数结合了“forecast”包中的多个组件模型。至少,用户必须为 y
提供一个 ts 或数字向量请指出我做错了什么。