I'm using R together with the forecast
package to set up a ARIMA model, that will be used to predict a energy related variable. I used auto.arima()
to fit different models (according to geographic region), and I need to put the model coefficients in our database, so that the IT folks can automate things. That's exactly the problem: I simply don't know how set up the equations by looking at the model:
ARIMA(1,0,1)(2,0,1)[12] with non-zero mean
Coefficients:
ar1 ma1 sar1 sar2 sma1 intercept prec0 prec1
0.3561 0.3290 0.6857 0.2855 -0.7079 11333.240 15.5291 28.0817
s.e. 0.2079 0.1845 0.2764 0.2251 0.3887 2211.302 6.2147 6.0906
I have 2 regressor variables (prec0 and prec1). Given the residuals, the ARIMA vector ARIMA(1,0,1)(2,0,1)[12]
, the time series up to period $t$, the number $h$ of forecasting periods and the regressor matrix reg, how can I set a function to return the forecast values? I.e:
do.forecast = function(residuals, ARIMA, timeSeries, h, regMatrix)
{
p = ARIMA[1]
q = ARIMA[3]
## arima equations here...
}
Thanks!
PS: I know this is a possible duplicate of Reproducing ARIMA model outside R, but my model seems very different, and I really don't know how to start with.
Best Answer
You don’t need to write a forecast function. It has been already written in the “forecast” package. First save the fitted object, then use forecast function. Here is an example: