library(dplyr)
library(lubridate)
library(timetk)
lm_model <- lm(value ~ as.numeric(date) + hour(date) + wday(date, label = TRUE),
data = taylor_30_min)
data = tibble(
date = taylor_30_min$date, # Important - The column name must match the modeled data
# These are standardized names: .actual, .fitted, .residuals
.actual = taylor_30_min$value,
.fitted = lm_model$fitted.values %>% as.numeric(),
.residuals = lm_model$residuals %>% as.numeric()
)
new_modeltime_bridge(
class = "lm_time_series_impl",
models = list(model_1 = lm_model),
data = data,
extras = NULL
)
Run the code above in your browser using DataLab