After you've found the parameters for an ARIMA model, you can use them to forecast future values. The ARIMA model is usually written as ARIMA(p,d,q), where:
- p is the order of the autoregressive part
- d is the order of differencing
- q is the order of the moving average part
Let's denote Y as the time series we are interested in. If d=1, for example, we are actually modeling the difference between consecutive terms of Y. If d=2, we are modeling the second difference, and so on.
Given a time series {Y_t}, the mathematical representation of an ARIMA model is as follows:
ARIMA(p,0,q): Y_t = c + Σ(φ_i * Y_t-i) + θ_1ε_t-1 + θ_2ε_t-2 + ... + θ_q*ε_t-q + ε_t
Where:
- c is a constant
- φ_i is the parameter of the autoregressive term of lag i
- θ_j is the parameter of the moving average term of lag j
- ε_t is the error term at time t
The autoregressive part (Σ(φ_i * Y_t-i)) is essentially a linear regression of the current value of the series against one or more prior values of the series.
The moving average part (Σ(θ_j * ε_t-j)) is a linear regression of the current value of the series against the one or more prior error terms.
Now, for forecasting:
- To forecast the value of Y at time t+1 (Y_t+1), you would plug the actual values of Y from time t, t-1, ..., t-p into the autoregressive part of the model, and you would plug the estimated or actual errors from time t, t-1, ..., t-q into the moving average part of the model.
- To forecast further into the future (Y_t+2, Y_t+3, ...), you would use your forecasted values as the 'actual' values in the autoregressive part of the model.
Keep in mind that this is a simplified explanation. ARIMA models can get quite complex depending on the order of differencing and the specifics of the time series you're working with. Also, the model assumes that the time series is stationary, which is not always the case in real-world data. If the series is not stationary, it may need to be transformed before fitting the model.