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
xreg
to add the extra columns. But you will need to supply example regressors for the forecastauto.arima(data, xreg=as.matrix(mydata[-1]))
– Pierre Lc2
and one forc3
. You can add that matrix to the forecast. Remember, you are not forecasting all three columns, rather you are forecastingc1
based on time andc2
andc3
. The time variable is inherently supplied, the others must be supplied by you. – Pierre Lc2
andc3
one step ahead is supposed to be supplied by me but isn't the best way of pickingc2
andc3
actually to forecast them separately and pick that value? – Deusdeorumts(c2)
estimate and the same forc3
. I've used that before. – Pierre L