Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

MA Models

The MA(qq) model is given by:

yt=μ+ϵt+θ1ϵt−1+⋯+θqϵt−q\begin{align*} y_t = \mu + \epsilon_t + \theta_1 \epsilon_{t-1} + \dots + \theta_q \epsilon_{t-q} \end{align*}

The parameters are μ,θ1,…,θq\mu, \theta_1, \dots, \theta_q as well as σ\sigma (note ϵt∼i.i.dN(0,σ2)\epsilon_t \overset{\text{i.i.d}}{\sim} N(0, \sigma^2)).

Usually the MA(qq) model is applicable either after some basic preprocessing involving differencing (such as log⁡yt−log⁡yt−1\log y_t - \log y_{t-1}) or to residuals after fitting an AR model. Here is a simple standard example for fitting MA(1).

The Varve dataset

Consider the varve dataset from the Shumway and Stoffer book. It records the thickness of yearly glacial varves—layers of sediment deposited by melting glaciers—collected from a single site in Massachusetts. Each varve represents one year of sedimentation, formed when meltwater streams carried sand and silt into a glacial lake during the spring and summer melt seasons at the end of the last Ice Age. The dataset contains 634 annual measurements, covering a continuous period that began about 11,834 years ago, when the glaciers in New England were retreating. Thicker varves indicate warmer years with more melting and heavier sediment flow, while thinner varves reflect colder years with less melting. Although these deposits stopped forming thousands of years ago when the glacial lake drained, the preserved layers now provide scientists with a high-resolution record of past climate variations, helping reconstruct temperature and melting patterns during the planet’s transition out of the Ice Age.

See Example 2.6 of the Shumway-Stoffer book, 4th edition, for more details on the dataset.

<Figure size 640x480 with 1 Axes>

We shall work with the logarithms of the raw data.

<Figure size 640x480 with 1 Axes>

Fitting a stationary model such as MA(qq) is not appropriate for the logarithmed data. This is because the data does not seem to have constant mean. To deal with this, we difference the data as follows.

<Figure size 640x480 with 1 Axes>

Now let us look at the sample acf of this dataset.

<Figure size 640x480 with 1 Axes>

It is clear that the sample ACF shows one negative nonnegligible spike at lag one. The other spikes seem insignificant. This is MA(1) behaviour which suggests that the MA(1) should be appropriate for this data (which is differenced logarithms of the varve data).

Fitting MA models using the ARIMA function

Fitting MA models to data is more complicated compared to AR models. We use an inbuilt function in statsmodels called ARIMA for this. ARIMA models (which we will define later) are determined by three orders (p,d,q)(p, d, q). pp denotes the AR order, qq denotes the MA order, and dd denotes differencing. To fit the MA(1) model, we take p=0,d=0p = 0, d = 0 and q=1q = 1.

                               SARIMAX Results                                
==============================================================================
Dep. Variable:                      y   No. Observations:                  633
Model:                 ARIMA(0, 0, 1)   Log Likelihood                -440.678
Date:                Thu, 05 Nov 2026   AIC                            887.356
Time:                        19:09:44   BIC                            900.707
Sample:                             0   HQIC                           892.541
                                - 633                                         
Covariance Type:                  opg                                         
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
const         -0.0013      0.004     -0.280      0.779      -0.010       0.008
ma.L1         -0.7710      0.023    -33.056      0.000      -0.817      -0.725
sigma2         0.2353      0.012     18.881      0.000       0.211       0.260
===================================================================================
Ljung-Box (L1) (Q):                   9.16   Jarque-Bera (JB):                 7.58
Prob(Q):                              0.00   Prob(JB):                         0.02
Heteroskedasticity (H):               0.95   Skew:                            -0.22
Prob(H) (two-sided):                  0.69   Kurtosis:                         3.30
===================================================================================

Warnings:
[1] Covariance matrix calculated using the outer product of gradients (complex-step).
[-0.00125667 -0.77099236  0.23528045]
mu_hat = -0.0013, theta_hat = -0.7710, sigma_hat =  0.4851

This ARIMA function can be applied on the log varve data also, instead of first differencing and then applying it on the differenced log data. If we are not using differencing data, we have to use d = 1 in the ARIMA function (i.e., (p,d,q)(p, d, q) = (0,1,1)(0, 1, 1)).

                               SARIMAX Results                                
==============================================================================
Dep. Variable:                      x   No. Observations:                  634
Model:                 ARIMA(0, 1, 1)   Log Likelihood                -440.718
Date:                Thu, 05 Nov 2026   AIC                            885.435
Time:                        19:11:57   BIC                            894.336
Sample:                             0   HQIC                           888.892
                                - 634                                         
Covariance Type:                  opg                                         
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
ma.L1         -0.7705      0.023    -32.948      0.000      -0.816      -0.725
sigma2         0.2353      0.012     19.124      0.000       0.211       0.259
===================================================================================
Ljung-Box (L1) (Q):                   9.10   Jarque-Bera (JB):                 7.59
Prob(Q):                              0.00   Prob(JB):                         0.02
Heteroskedasticity (H):               0.95   Skew:                            -0.22
Prob(H) (two-sided):                  0.69   Kurtosis:                         3.30
===================================================================================

Warnings:
[1] Covariance matrix calculated using the outer product of gradients (complex-step).

Note now that there is no constant. This ARIMA function, by default, fits yt=ϵt+θϵt−1y_t = \epsilon_t + \theta \epsilon_{t-1} (with no μ\mu i.e., with μ=0\mu = 0) if the differencing order is strictly positive.

Fitting using conditional likelihood with ϵ0=0\epsilon_0 = 0.

Instead of using the ARIMA function, we can also try to use a first principles approach to estimate the parameters, by writing the conditional likelihood assuming ϵ0=0\epsilon_0 = 0.

Let ϵ^1=y1−μ\hat{\epsilon}_1 = y_1 - \mu and, for t=2,…,nt = 2, \dots, n,

ϵ^t=yt−μ−θϵ^t−1\hat{\epsilon}_t = y_t- \mu - \theta \hat{\epsilon}_{t-1}

The sum of squares is given by:

S(μ,θ):=∑t=1nϵ^t2\begin{align*} S(\mu, \theta) := \sum_{t=1}^n \hat{\epsilon}_t^2 \end{align*}

so that the likelihood and log-likelihood become

likelihood=(1σ2π)nexp⁡(−S(μ,θ)2σ2)\begin{align*} \text{likelihood} = \left(\frac{1}{\sigma \sqrt{2 \pi}} \right)^n \exp \left(-\frac{S(\mu, \theta)}{2 \sigma^2} \right) \end{align*}

and

log-likelihood=−n2log⁡(σ2)−S(μ,θ)2σ2.\begin{align*} \text{log-likelihood} = -\frac{n}{2} \log (\sigma^2) - \frac{S(\mu, \theta)}{2 \sigma^2}. \end{align*}

Thus the MLEs of μ,θ\mu, \theta are obtained by minimizing S(μ,θ)S(\mu, \theta), and the MLE of σ\sigma is

σ^=S(μ^,θ^)n\begin{align*} \hat{\sigma} = \sqrt{\frac{S(\hat{\mu}, \hat{\theta})}{n}} \end{align*}

Here is the code for the function S(μ,θ)S(\mu, \theta).

We will use the function ‘minimize’ from scipy.optimize to minimize S_func.

  message: Optimization terminated successfully.
  success: True
   status: 0
      fun: 149.00423625212122
        x: [-1.137e-03 -7.728e-01]
      nit: 12
      jac: [-3.815e-06 -1.907e-06]
 hess_inv: [[ 4.137e-05  5.724e-06]
            [ 5.724e-06  2.545e-03]]
     nfev: 63
     njev: 21
Estimated mu: -0.001136648493518346
Estimated theta: -0.7728310156211502

Let us compare the estimates obtained from the above code, with the estimates given by the ARIMA function.

[-0.00113665 -0.77283102]
[-0.00125667 -0.77099236  0.23528045]

The estimates are similar (the third estimate is that of σ2\sigma^2).

Estimated sigma: 0.4851739256751231
MA reported sigma: 0.48505715819375406

The estimates of σ\sigma are also similar.

Standard Errors corresponding to the parameter estimates

After obtaining the MLEs μ^\hat{\mu} and θ^\hat{\theta}, the next step is to obtain standard errors. These are reported by the ARIMA function. We can also derive this using the Bayesian approach with the conditional likelihood. We use the Bayesian approach with the standard prior:

μ,θ,log⁡σ∼i.i.dunif(−C,C).\begin{align*} \mu, \theta, \log \sigma \overset{\text{i.i.d}}{\sim} \text{unif}(-C, C). \end{align*}

The posterior is then

fμ,θ,σ∣data(μ,θ,σ)∝(12πσ)nexp⁡(−S(μ,θ)2σ2)×1σI{−C<μ,θ,log⁡σ<C}∝σ−n−1exp⁡(−S(μ,θ)2σ2)I{−C<μ,θ,log⁡σ<C}\begin{align*} f_{\mu, \theta, \sigma \mid \text{data}}(\mu, \theta, \sigma) &\propto \left(\frac{1}{\sqrt{2 \pi}\sigma}\right)^n \exp \left(-\frac{S(\mu, \theta)}{2 \sigma^2} \right) \times \frac{1}{\sigma} I\{ -C < \mu, \theta, \log \sigma < C\} \\ &\propto \sigma^{-n-1} \exp \left(-\frac{S(\mu, \theta)}{2 \sigma^2} \right) I\{ -C < \mu, \theta, \log \sigma < C\} \end{align*}

This is the joint posterior of μ,θ,σ\mu, \theta, \sigma. To obtain the posterior of μ,θ\mu, \theta (without σ\sigma), we integrate the above over σ\sigma (from 0 to ∞\infty). This integration is exactly the same as Lecture 4, and we get

fμ,θ∣data(μ,θ)∝(1S(μ,θ))n/2I{−C<μ,θ<C}∝(S(μ^,θ^)S(μ,θ))n/2I{−C<μ,θ<C}\begin{align*} f_{\mu, \theta \mid \text{data}}(\mu, \theta) \propto \left(\frac{1}{S(\mu, \theta)} \right)^{n/2} I\{ -C < \mu, \theta < C\} \propto \left(\frac{S(\hat{\mu}, \hat{\theta})}{S(\mu, \theta)} \right)^{n/2} I\{ -C < \mu, \theta < C\} \end{align*}

If S(μ,θ)S(\mu, \theta) is a quadratic function of μ,θ\mu, \theta, then this will be a tt-density. However our S(μ,θ)S(\mu, \theta) will involve higher powers of θ\theta and is not quadratic. The posterior usually is fairly concentrated around the MLE (μ^,θ^)(\hat{\mu}, \hat{\theta}) though, so we it makes sense to approximate S(μ,θ)S(\mu, \theta) by a quadratic around (μ^,θ^)(\hat{\mu}, \hat{\theta}). This is done by Taylor expansion as follows. Let α=(μ,θ)\alpha = (\mu, \theta) and α^=(μ^,θ^)\hat{\alpha} = (\hat{\mu}, \hat{\theta}). Taylor expansion for α\alpha near α^\hat{\alpha} gives

S(α)=S(α^)+<∇S(α^),α−α^>+(α−α^)T(12HS(α^))(α−α^)=S(α^)+(α−α^)T(12HS(α^))(α−α^)\begin{align*} S(\alpha) &= S(\hat{\alpha}) + \left<\nabla S(\hat{\alpha}), \alpha - \hat{\alpha} \right> + \left(\alpha - \hat{\alpha} \right)^T \left(\frac{1}{2} HS(\hat{\alpha}) \right) \left(\alpha - \hat{\alpha} \right) \\ &= S(\hat{\alpha}) + \left(\alpha - \hat{\alpha} \right)^T \left(\frac{1}{2} HS(\hat{\alpha}) \right) \left(\alpha - \hat{\alpha} \right) \end{align*}

where we used ∇S(α^)=0\nabla S(\hat{\alpha}) = 0 because α^\hat{\alpha} minimizes S(α)S(\alpha). Here HS(α^)HS(\hat{\alpha}) denotes the Hessian of SS at α^\hat{\alpha}.

Therefore

fμ,θ∣data(μ,θ)∝(1S(μ,θ))n/2I{−C<μ,θ<C}∝(S(α^)S(α))n/2I{−C<μ,θ<C}=(S(α^)S(α^)+(α−α^)T(12HS(α^))(α−α^))n/2I{−C<μ,θ<C}=(11+(α−α^)T(12S(α^)HS(α^))(α−α^))n/2I{−C<μ,θ<C}=(11+1n−2(α−α^)T(n−22S(α^)HS(α^))(α−α^))n−2+22I{−C<μ,θ<C}.\begin{align*} & f_{\mu, \theta \mid \text{data}}(\mu, \theta) \\ &\propto \left(\frac{1}{S(\mu, \theta)} \right)^{n/2} I\{ -C < \mu, \theta < C\} \\ &\propto \left(\frac{S(\hat{\alpha})}{S(\alpha)} \right)^{n/2} I\{ -C < \mu, \theta < C\} \\ &= \left(\frac{S(\hat{\alpha})}{S(\hat \alpha) + \left(\alpha - \hat{\alpha} \right)^T \left(\frac{1}{2} HS(\hat{\alpha}) \right) \left(\alpha - \hat{\alpha} \right)} \right)^{n/2} I\{-C < \mu, \theta < C\} \\ &= \left(\frac{1}{1 + \left(\alpha - \hat{\alpha} \right)^T \left(\frac{1}{2 S(\hat{\alpha})} HS(\hat{\alpha}) \right) \left(\alpha - \hat{\alpha} \right)} \right)^{n/2} I\{-C < \mu, \theta < C\} \\ &= \left(\frac{1}{1 + \frac{1}{n-2}\left(\alpha - \hat{\alpha} \right)^T \left(\frac{n-2}{2 S(\hat{\alpha})} HS(\hat{\alpha}) \right) \left(\alpha - \hat{\alpha} \right)} \right)^{\frac{n-2+2}{2}} I\{-C < \mu, \theta < C\}. \end{align*}

Comparing the above with the formula:

(11+1k(x−m)TΣ−1(x−m))k+p2\begin{align*} \left(\frac{1}{1 + \frac{1}{k} (x - m)^T \Sigma^{-1} (x - m)} \right)^{\frac{k + p}{2}} \end{align*}

for the pp-variate tt-density tk,p(μ,Σ)t_{k, p}(\mu, \Sigma), we see that (ignoring the indicator function I{−C<μ,θ<C} I\{-C < \mu, \theta < C\})

α∣data∼tn−2,2(α^,S(α^)n−2(12HS(α^))−1).\begin{align*} \alpha \mid \text{data} \sim t_{n-2, 2} \left(\hat{\alpha}, \frac{S(\hat{\alpha})}{n - 2} \left(\frac{1}{2} HS(\hat{\alpha}) \right)^{-1} \right). \end{align*}

So the standard errors corresponding to μ\mu and θ\theta can be obtained by taking the square roots of the diagonal entries of

S(α^)n−2(12HS(α^))−1\begin{align*} \frac{S(\hat{\alpha})}{n - 2} \left(\frac{1}{2} HS(\hat{\alpha}) \right)^{-1} \end{align*}

In order to compute these, we need to calculate the Hessian of S(α)S(\alpha) with respect to α\alpha. We will use numerical differentiation (specifically a function from the library numdifftools) for this.

Estimated mu: -0.001136648493518346
Estimated theta: -0.7728310156211502
Estimated sigma: 0.4859422142413731
Covariance matrix:
 [[1.94152431e-05 8.28638953e-07]
 [8.28638953e-07 1.17034005e-03]]
Standard errors: [0.00440627 0.03421023]
MA standard errors: [0.00448462 0.02332403]

The standard error corresponding to θ\theta that we computed is a little off from the one reported by the ARIMA function, but the standard errors corresponding to μ\mu are almost the same.

Note that we did not calculate standard errors for σ\sigma. This can be done by calculating the posterior of σ\sigma (this can be written in terms of the chi-squared distribution).

The ARIMA function works with the full likelihood unlike the analysis above which works with the conditional likelihood (conditioning on ϵ0=0\epsilon_0 = 0). So the answers will be slightly different. The full likelihood is more complicated to write down.

There are actually multiple ways of computing the standard errors. The default option in ARIMA uses ‘opg’ (outer product of gradients). Instead if we use another option called ‘approx’, we get answers that are quite similar to the standard errors that we computed.

                               SARIMAX Results                                
==============================================================================
Dep. Variable:                      y   No. Observations:                  633
Model:                 ARIMA(0, 0, 1)   Log Likelihood                -440.678
Date:                Fri, 06 Nov 2026   AIC                            887.356
Time:                        20:24:52   BIC                            900.707
Sample:                             0   HQIC                           892.541
                                - 633                                         
Covariance Type:               approx                                         
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
const         -0.0013      0.004     -0.283      0.777      -0.010       0.007
ma.L1         -0.7710      0.034    -22.600      0.000      -0.838      -0.704
sigma2         0.2353      0.013     17.791      0.000       0.209       0.261
===================================================================================
Ljung-Box (L1) (Q):                   9.16   Jarque-Bera (JB):                 7.58
Prob(Q):                              0.00   Prob(JB):                         0.02
Heteroskedasticity (H):               0.95   Skew:                            -0.22
Prob(H) (two-sided):                  0.69   Kurtosis:                         3.30
===================================================================================

Warnings:
[1] Covariance matrix calculated using numerical (complex-step) differentiation.
MA standard errors: [0.00443883 0.03411461]
Standard errors: [0.00440627 0.03421023]

GDP Dataset

In the last couple of lectures, we looked at the GDP dataset.

  observation_date      GDP
0       1947-01-01  243.164
1       1947-04-01  245.968
2       1947-07-01  249.585
3       1947-10-01  259.745
4       1948-01-01  265.742
<Figure size 640x480 with 1 Axes>

We split this into training and test datasets as follows.

We fit models to logarithms of the raw data.

In the last lecture (Lecture 19), we fit the AR(4) model to the training data. In Lecture 18, we fit AR(1). Below, we re-fit these models and then check out the obtained residuals.

                            AutoReg Model Results                             
==============================================================================
Dep. Variable:                      y   No. Observations:                  269
Model:                     AutoReg(4)   Log Likelihood                 863.305
Method:               Conditional MLE   S.D. of innovations              0.009
Date:                Thu, 05 Nov 2026   AIC                          -1714.610
Time:                        19:31:53   BIC                          -1693.131
Sample:                             4   HQIC                         -1705.980
                                  269                                         
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
const          0.0141      0.004      3.654      0.000       0.007       0.022
y.L1           1.4221      0.060     23.637      0.000       1.304       1.540
y.L2          -0.1959      0.103     -1.904      0.057      -0.398       0.006
y.L3          -0.3830      0.103     -3.723      0.000      -0.585      -0.181
y.L4           0.1560      0.060      2.599      0.009       0.038       0.274
                                    Roots                                    
=============================================================================
                  Real          Imaginary           Modulus         Frequency
-----------------------------------------------------------------------------
AR.1           -1.8586           -0.0000j            1.8586           -0.5000
AR.2            1.0016           -0.0000j            1.0016           -0.0000
AR.3            1.6563           -0.8373j            1.8559           -0.0745
AR.4            1.6563           +0.8373j            1.8559            0.0745
-----------------------------------------------------------------------------

Let us look at the residuals of the fitted AR model.

<Figure size 1100x300 with 1 Axes>

Below we plot the sample ACF of the residuals of the fitted AR model.

<Figure size 640x480 with 1 Axes>

The AR(4) residuals do not have any autocorrelations, so i.i.d N(0,σ2)N(0, \sigma^2) is a good assumption for the errors in AR(4). But the AR(1) residuals have many autocorrelations including at lags 1 and 2. Below we look at the predictions obtained by AR(4), and also AR(1) followed by MA(2) for the residuals, and also ARMA(1, 2) applied directly.

Here are the predictions for the AR(4) model and its prediction error (MSE on the log-scale).

Test MSE (log scale): 0.0015580683441375326

Next we fit ARMA(1, 2). If we use ARIMA(data, order = (1, 0, 2)), the resulting predictions are not very good. This is because the default method for fitting parameters tries to force the parameters into certain regions (the so-called ‘stationary’ regions) which is not a good thing in this dataset. It is better to not enforce any such contraints. For the ARIMA function, this explicitly requires the option enforce_stationarity = False in some cases.

                               SARIMAX Results                                
==============================================================================
Dep. Variable:                      y   No. Observations:                  269
Model:                 ARIMA(1, 0, 2)   Log Likelihood                 861.010
Date:                Thu, 05 Nov 2026   AIC                          -1712.021
Time:                        19:35:13   BIC                          -1694.103
Sample:                             0   HQIC                         -1704.822
                                - 269                                         
Covariance Type:                  opg                                         
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
const         15.7107      3.389      4.635      0.000       9.068      22.354
ar.L1          0.9980      0.001   1277.482      0.000       0.996       1.000
ma.L1          0.3951      0.045      8.819      0.000       0.307       0.483
ma.L2          0.2976      0.047      6.391      0.000       0.206       0.389
sigma2      9.015e-05   5.27e-06     17.110      0.000    7.98e-05       0.000
===================================================================================
Ljung-Box (L1) (Q):                   0.32   Jarque-Bera (JB):                68.97
Prob(Q):                              0.57   Prob(JB):                         0.00
Heteroskedasticity (H):               0.26   Skew:                             0.11
Prob(H) (two-sided):                  0.00   Kurtosis:                         5.48
===================================================================================

Warnings:
[1] Covariance matrix calculated using the outer product of gradients (complex-step).
Test MSE (log scale): 0.0022550929815539304

Below we plot the predictions for the two models (AR(4) and ARMA(1, 2)) along with the actual data.

<Figure size 1200x400 with 1 Axes>

Instead of fitting ARMA(1, 2) directly, we can first fit AR(1) and then MA(2) to the residuals. This is implemented below. We also obtain predictions here in the following way. We first obtain predictions for the fitted MA(2) model, then we combine with the AR(1) equation to get predictions which can be compared with the test data.

                            AutoReg Model Results                             
==============================================================================
Dep. Variable:                      y   No. Observations:                  269
Model:                     AutoReg(1)   Log Likelihood                 830.433
Method:               Conditional MLE   S.D. of innovations              0.011
Date:                Thu, 05 Nov 2026   AIC                          -1654.866
Time:                        19:38:19   BIC                          -1644.093
Sample:                             1   HQIC                         -1650.539
                                  269                                         
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
const          0.0283      0.004      7.232      0.000       0.021       0.036
y.L1           0.9984      0.000   2014.926      0.000       0.997       0.999
                                    Roots                                    
=============================================================================
                  Real          Imaginary           Modulus         Frequency
-----------------------------------------------------------------------------
AR.1            1.0016           +0.0000j            1.0016            0.0000
-----------------------------------------------------------------------------
                               SARIMAX Results                                
==============================================================================
Dep. Variable:                      y   No. Observations:                  268
Model:                 ARIMA(0, 0, 2)   Log Likelihood                 867.112
Date:                Thu, 05 Nov 2026   AIC                          -1728.223
Time:                        19:38:19   BIC                          -1717.450
Sample:                             0   HQIC                         -1723.896
                                - 268                                         
Covariance Type:                  opg                                         
==============================================================================
                 coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
ma.L1          0.3920      0.045      8.735      0.000       0.304       0.480
ma.L2          0.2926      0.046      6.294      0.000       0.202       0.384
sigma2      9.043e-05   5.23e-06     17.287      0.000    8.02e-05       0.000
===================================================================================
Ljung-Box (L1) (Q):                   0.30   Jarque-Bera (JB):                70.92
Prob(Q):                              0.58   Prob(JB):                         0.00
Heteroskedasticity (H):               0.27   Skew:                             0.19
Prob(H) (two-sided):                  0.00   Kurtosis:                         5.49
===================================================================================

Warnings:
[1] Covariance matrix calculated using the outer product of gradients (complex-step).
Test MSE (log scale): 0.0015863499144756973

Below we plot the predictions for all the three models.

<Figure size 1200x400 with 1 Axes>

To better see the differences between the predictions, we zoom into the predictions.

<Figure size 1200x400 with 1 Axes>

The AR(4) and AR(1)-MA(2) predictions are quite close to each other. The ARMA(1, 2) predictions also agree with these for the initial future period but they depart after a few quarters.

Below we loop over all ARIMA(p, d, q) models with p, q at most 5 and d at most 2, and then find the best model in terms of the model selection criteria AIC and BIC.

Best model by AIC:
p         1.000000
d         0.000000
q         2.000000
AIC   -1712.020578
BIC   -1694.103096
Name: 20, dtype: float64

Best model by BIC:
p         1.000000
d         0.000000
q         2.000000
AIC   -1712.020578
BIC   -1694.103096
Name: 20, dtype: float64

It is interesting that this automatic model selection approach also selects the model ARMA(1, 2).