我在石油和天然气行业工作。
我一直在尝试用协变量构建一个ts预测模型,模型R代码如下:
#Getting R libraries:
library(readxl)
library(ggplot2)
library(forecast)
library(timeSeries)
library(tseries)
library(MTS)
#Create a time series object:
myts <- ts(dataset, start = c(2005,1), end = c(2019,12), frequency = 12)
#Illustrate out of sample forecasting with covariates, splitting the data:
train <- window(myts, end = c(2018,12))
test <- window(myts, start = c(2019,1))
#Fitting the time series forecasting model:
covariates <- c("Income","Prices","Sites","Vehicles")
fit <- auto.arima(train[,"Volumes"], xreg = train[,covariates])
#Forecasting from test data:
mytsfcast <- forecast(fit, h = 6*12, xreg = test[,covariates])
autoplot(mytsfcast)
但是,我一直在尝试预测 12、24、36 等月份的零售量。该模型仅生成以下结果:
模型拟合结果:
请问您能否就如何让我的模型预测超出 end = c(2019,12) 提出建议。我错过了什么?