How do I choose which parameters to estimate in an ARMA model in python statsmodel? [closed]

Say I have come to the conclusion that the model for a specific data set should be an ARMA model with parameters a1, a2, a3, a9, a10, a11 and c1, c2, c3, c9, c10, c11, c12.

How can I do a model fitting using only these parameters, and thus setting all other possible parameters to zero?

• I think more detail is going to be needed for someone to answer this. – mdewey Dec 22 '16 at 12:47

I guess that you want to estimate the $a$ and $c$ parameters of the following model:

$$y_t = a_1 y_{t-1} + a_2 y_{t-2} + a_3 y_{t-3} + a_9 y_{t-9} + a_{10} y_{t-10} + a_{11} y_{t-11} + \varepsilon_t + c_1 \varepsilon_{t-1} + c_2 \varepsilon_{t-2} + c_3 \varepsilon_{t-3} + c_9 \varepsilon_{t-9} + c_{10} \varepsilon_{t-10} + c_{11} \varepsilon_{t-11} + c_{12} \varepsilon_{t-12}$$

If this was a pure AR model (i.e. without any of the $c$ parameters), then you could simply run OLS on the lagged data and exclude the lags you didn't care about (like $y_{t-4}$).

However, since this is an ARMA model, you can't estimate it via OLS. Depending on the software you're using, there would be different commands.

For example, in Stata you would do (edit: added the noconstant command to not include an intercept):

arima data, ar(1 2 3 9 10 11) ma(1 2 3 9 10 11 12) noconstant


and in Statsmodels (Python library) you would do:

ar_order = np.ones(11)
ar_order[[3, 4, 5, 6, 7]] = 0
ma_order = np.ones(12)
ma_order[[3, 4, 5, 6, 7]] = 0
mod = sm.tsa.SARIMAX(data, order=(ar_order, 0, ma_order))
res = mod.fit()


(The reason you set the 3, 4, 5, 6, and 7 indexes to zero is that python arrays are zero-indexed, so this corresponds to lags 4, 5, 6, 7, and 8).

the result of e.g. the Python call is:

                                               Statespace Model Results
======================================================================================================================
Dep. Variable:                                                              y   No. Observations:                  123
Model:             SARIMAX((1, 2, 3, 9, 10, 11), 0, (1, 2, 3, 9, 10, 11, 12))   Log Likelihood                 382.923
Date:                                                        Thu, 22 Dec 2016   AIC                           -737.845
Time:                                                                19:26:13   BIC                           -698.475
Sample:                                                                     0   HQIC                          -721.853
- 123
Covariance Type:                                                          opg
==============================================================================
coef    std err          z      P>|z|      [0.025      0.975]
------------------------------------------------------------------------------
ar.L1          0.4821      1.671      0.288      0.773      -2.794       3.758
ar.L2          0.4694      1.962      0.239      0.811      -3.376       4.315
ar.L3         -0.0187      1.111     -0.017      0.987      -2.195       2.158
ar.L9         -0.1609      0.494     -0.326      0.745      -1.129       0.807
ar.L10         0.2037      0.791      0.258      0.797      -1.347       1.754
ar.L11         0.0034      0.717      0.005      0.996      -1.402       1.409
ma.L1         -0.0472      1.705     -0.028      0.978      -3.389       3.295
ma.L2         -0.2908      1.428     -0.204      0.839      -3.090       2.508
ma.L3         -0.0534      0.615     -0.087      0.931      -1.258       1.152
ma.L9          0.0396      0.477      0.083      0.934      -0.895       0.975
ma.L10        -0.1194      0.601     -0.199      0.843      -1.298       1.059
ma.L11        -0.0876      0.388     -0.226      0.821      -0.848       0.673
ma.L12        -0.0665      0.272     -0.244      0.807      -0.600       0.467
sigma2         0.0001   1.01e-05     11.306      0.000    9.43e-05       0.000
===================================================================================
Ljung-Box (Q):                       29.93   Jarque-Bera (JB):                63.00
Prob(Q):                              0.88   Prob(JB):                         0.00
Heteroskedasticity (H):               3.04   Skew:                             0.42
Prob(H) (two-sided):                  0.00   Kurtosis:                         6.41
===================================================================================

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


If you want the other parameters to be set to zero for the entire model, you simply don't include the other variables. I'm not sure exactly what kinds of data you're working with, but it seems like you're examining 11 or 12 "things" with an "a" parameter and a "c" parameter. As I understand you, you've collected data with a4, c4, a5, c5, etc., and you've decided you do not want those in your model.

You're under no obligation to include all your data in the ARIMA model. Simply run it with the variables you listed and no others. If you require speciffics, please let us know what software you're working with.

You may or may not need to explain why you decided not to include variables 4, 5, etc. in the final model. For example, "p<.10 was used as cutoff for inclusion in the model. Additionally, item 7 was excluded due to an insufficient number of observations to allow for quality analysis. The final model used items 1, 2, 3, 9, 10, 11, and 12 to explain [the dependent variable]."