The Autoregressive Moving Average temperature model

The Autoregressive Moving Average (ARMA) model mixes the Autoregressive (AR) and Moving Average (MA) models. We have already discussed both models. Informally, we can say that we have the autoregressive component with white noise around it. Part of this white noise can be modeled as a linear combination of lag components plus some constant as follows:

  1. Define an autoregressive model with lag 2 using linear coefficients we obtained with a previous script:
    def ar(a):
       ar_p = [1.06517683, -0.08293789]
     
       return ar_p[0] * a[1:-1] + ar_p[1] * a[:-2]
  2. Define the moving average model with lag 1:
    def model(p, ma1):
       c0, c1 = p
     
       return c0 + c1 * ma1
  3. Subtract the autoregressive model values from the data, giving us ...

Get Learning NumPy Array 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.