Search code examples
pythontime-seriesstatsmodelsarimarestriction

Zero-restrictions on ARIMAX coefficients using statsmodels.tsa.arima


I am trying to estimate an ARIMAX model with p=96 and q=96 as only non-zero coefficients (meaning all lag orders <96 have coefficient zero). The doc of statsmodels.tsa.arima.model.ARIMA¶ states that a list can be supplied for the lag orders p and q. I first tried this using the code below.

p=[96]
q=p.copy()
d=0

order_tuple=(p,d,q)

for i in range(start,len(df_series)+1 -(96)):
  endog= df_series.iloc[0:i-1,:]['1']
  exog=df_series.iloc[0:i-1,:]['temp']

  ARIMAX=ARIMA(endog.values, exog=exog.values, order=order_tuple)
  ARIMAX_fit=ARIMAX.fit()

However, the following error occured after trying to fit the model:

--> 428         _check_estimable(len(self.endog), sum(order))
    429         self.k_ar = k_ar = order[0]
    430         self.k_ma = k_ma = order[1]

TypeError: unsupported operand type(s) for +: 'int' and 'list'

I also tried the pyflux ARIMAX model, but this did not allow for zero-restrictions. Any idea how to solve this?

Thanks in advance!


Solution

  • It looks like you are using the old model. You need to do either:

    from statsmodels.tsa.arima.model import ARIMA
    
    ARIMA(...)
    

    or

    import statsmodels.api as sm
    
    sm.tsa.arima.ARIMA(...)