Time series forecasting

With the parameter estimates having been defined, we're finally in a position to use our model for forecasting. We've actually already written most of the code we need to do this: we have an arma function that's capable of generating an autoregressive moving-average series based on some seed data and the model parameters p and q. The seed data will be our measured values of y from the airline data, and the values of p and q will be the parameters that we calculated using the Nelder-Mead method.

Let's plug those numbers into our ARMA model and generate a sequence of predictions for y:

(defn ex-9-32 [] (let [data (i/log (airline-passengers)) diff-1 (difference 1 data) diff-12 (difference 12 diff-1) forecast (->> (arma (take ...

Get Clojure for Data Science now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.