ARIMA models are usually a great and straightforward way to forecast a time series with certain assumptions. However, when these fail, ARIMA models are not able to respond properly. Let me illustrate this with a hands-on example with R.
We will use the tseries and forecast packages.
require(forecast) require(tseries) data(ice.river) series = flow.vat plot(series)
We immediately check that this series follows a pattern: at the beggining of each year, predictions should become more volatile as the value goes up. Well, let’s check how ARIMA models behave.
ari = auto.arima(flow.vat) plot(forecast(ari),h=365)
This prediction is quite useless, despite the fact that the confidence interval width is rising as time passes. If anyone’s interested in fitting a GARCH model to the data, I tried GARCH(1,1) and (2,2) with similar results.
Time to check neural nets! Lagged inputs can be use to feed a one-layer hidden neural net à la regression. (For a quick tutorial on how these work, check https://www.otexts.org/fpp/9/3).
model = nnetar(flow.vat) plot(forecast(model),h=365)
Neat! Neural nets seem to capture the pattern of the series pretty well. However, due to the nature of the approach, a confidence interval for the prediction is unavailable.