数据是这样的:
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;它给出错误:&#34;时间序列必须是数字,可能不是矩阵或数据框对象。&#34;
但是在链接上:https://cran.r-project.org/web/packages/forecastHybrid/vignettes/forecastHybrid.html
明确提到:该软件包的主要功能是hybridModel(),它结合了“预测”软件包中的几个组件模型。用户必须至少为y
提供ts或数字向量请说明我做错了什么。