Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

forecasting ARIMA model with extra regressors

Suppose i have some time series as below and i want to forecast c1 one step a head, doing so is pretty straight forward and easy in R:

testurl = "https://docs.google.com/spreadsheets/d/1jtpQaSxNY1V3b-Xfa5OJKDCLE6pNlzTbwhSHByei4EA/pub?gid=0&single=true&output=csv"
test = getURL(testurl)
mydata = read.csv(textConnection(test), header = TRUE)
data <- ts(mydata['c1'])
fit <- auto.arima(data)
fcast <- forecast(fit)
fcast

note that the numbers is just random numbers, and the auto.arima suggest us to use an arima(0,1,0) and the forecast one step a head is 52.

however, what if one want to use c2 and c3 to improve (in terms of aic and bic for example) the out of sample forecast? how would one actually continue then?

c1   c2     c3
40   0,012  1
41   0,015  1
42   0,025  1
40  −0,015  1
44   0,000  0
50   0,015  0
52   0,015  1
51   0,020  1
50   0,025  1
52   0,030  0
53   0,045  1
52   0,030  1
52   0,025  0
52   0,000  0
51   0,010  0
50  −0,02   1
48  −0,025  1
49  −0,030  1
51  −0,040  1
52  −0,350  0
like image 636
Deusdeorum Avatar asked Feb 20 '16 15:02

Deusdeorum


People also ask

How do you include exogenous variables in ARIMA?

One way to do ARIMA with exogenous variables would be ARIMAX. The variable selection process would be quite similar to other regressions. For in-sample you could compare AIC/BIC, for out-of-sample it's some version of root mean sqaured forecast error (RMSE). This could be one step ahead or multiple steps ahead.

How can I improve my ARIMA forecast?

1- Check again the stationarity of the time series using augmented Dickey-Fuller (ADF) test. 2- Try to increase the number of predictors ( independent variables). 3- Try to increase the sample size (in case of monthly data, to use at least 4 years data.

Is ARIMA model good for forecasting?

It is widely used in demand forecasting, such as in determining future demand in food manufacturing. That is because the model provides managers with reliable guidelines in making decisions related to supply chains. ARIMA models can also be used to predict the future price of your stocks based on the past prices.

Can ARIMA be used for multivariate analysis?

To deal with MTS, one of the most popular methods is Vector Auto Regressive Moving Average models (VARMA) that is a vector form of autoregressive integrated moving average (ARIMA) that can be used to examine the relationships among several variables in multivariate time series analysis.


1 Answers

If I understand correctly you're trying to fit a dynamic regression model to your data with xreg in auto.arima(). You can automatically determine a model fit using something like this:

tsdata <- ts(mydata)
fit <- auto.arima(tsdata[,1], xreg = as.matrix(mydata[,2:3]))

To generate your 1-step ahead forecast you will need to supply a matrix of future values of C2 and C3 to the xreg argument in the forecast function. One way you could do this would be like this:

fc.c2 <- forecast(tsdata[,2], h = 1)
fc.c3 <- forecast(tsdata[,3], h = 1)


newxreg <- as.matrix(cbind(fc.c2$mean, fc.c3$mean))

fc.c1 <- forecast(fit, xreg = newxreg)
like image 86
Rick Arko Avatar answered Sep 18 '22 11:09

Rick Arko