I'm trying to understand how auto.arima with covariates in the xreg parameter works. I'm familiar with regression and I'm starting to work on forecasting.
My understanding of forecasting is that you look for patterns in the past time series and then project those paterns onto the future.
My uderstanding of regression is that you use predictors to try to generate an output value and minimize the difference between your created value and the real value.
So how does forecasting auto.arima with xreg work? Do you create a forecast for a timeseries based on past data and regression model based on the input time series and input xreg, and then forecast each data point in the time series and for each forecasted data point use the regression model you built and future xreg values to adjust the forecasted values?
I'm a former physics grad student, so I'm not allergic to math but I'm just looking for a high level overview of the process here to understand how forecasting auto.arima works.
For example like,
step 1: build forecast model on input time series, and regression model on input time series and input
xregvaluesstep 2: forecast model into future one step, and predict value with regression model and future
xregvaluesstep 3: algorithm combines forecasted value and regression model prediction to get combined value
This is just a guess at how it works, but it's an example of the kind of high level explanation I'm looking for.
I've included some code below that I've been working on trying to forecast time in to out TiTo for customers at a restaurant with predictor count of customers in the restaurant CustCount.
OV<-zoo(SampleData$TiTo,
order.by=SampleData$DateTime)
eDate <- ts(OV, frequency = 24)
Train <-eDate[1:15000]
Test <- eDate[15001:22773]
xregTrain <- SampleData[1:15000,]$CustCount
xregTest <- SampleData[15001:22773,]$CustCount
Arima.fit <- auto.arima(Train, xreg = xregTrain)
Acast<-forecast(Arima.fit, h=7772, xreg = xregTest)
accuracy(Acast$mean,Test)
auto.arimaworks. (The latter is arguably off topic, & you could just look at the code anyway.) – gung - Reinstate Monica Feb 27 '16 at 03:20auto.arimabut rather about regression with ARMA errors as implemented inarimawith exogenous regressors. Try Rob J. Hyndman's blog post "The ARIMAX model muddle" and Hyndman & Khandakar "Automatic time series forecasting: the forecast package for R" (2008). – Richard Hardy Feb 27 '16 at 09:08