數據是這樣的:TS對象不forecastHybrid包hybridModel認可
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)
我想對時間序列數據進行ensemble.Below申請hybridModel是我的代碼:
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;它給出錯誤:「時間序列必須是數字,可能不是矩陣或數據框對象。」
但在鏈接:https://cran.r-project.org/web/packages/forecastHybrid/vignettes/forecastHybrid.html
這顯然提到:包的主力作用是hybridModel(),它結合了多種組件模型,從「預測」包的功能。至少,用戶必須提供一個ts或數字向量爲y
請建議我做錯了什麼。
@Gilles下載,你可以請this.Error是可重複的 – Ashag