我正在尝试在我的模型中添加一些额外的变量,如下所示:向我的数值变量添加新值没问题,但是当我尝试添加更多变量时出现问题
library(fpp3)
google_2015 <- gafa_stock %>%
filter(Symbol == "GOOG", year(Date) == 2015) %>%
mutate(trading_day = row_number()) %>%
update_tsibble(index = trading_day, regular = TRUE) %>%
mutate(qt = quarter(Date)) %>%
mutate(dow = as.factor(weekdays(Date)))
google_2015_stretch <- google_2015 %>%
stretch_tsibble(.init = 3, .step = 1) %>%
filter(.id != max(.id))
fit_cv <- google_2015_stretch %>%
model(tslm = TSLM(Close ~ Volume + Low + qt + dow))
f <- new_data(google_2015_stretch, 1) %>%
mutate(Volume = 1447601,
Low = 700,
qt = quarter(Date),
dow = as.factor(weekdays(Date)))
fc <- forecast(fit_cv, new_data = f)
fc %>% accuracy(
google_2015,
list(rmse = RMSE, mae = MAE, mape = MAPE, mase = MASE, crps = CRPS, winkler = winkler_score)
) %>%
arrange(rmse)
请,如果有人可以帮助我,将不胜感激