Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

non Invertible of a ARIMA model

I am trying to write a code to generate a series of arima model and compare different models.The code is as follow.

p=0
q=0
d=0
pdq=[]
aic=[]

for p in range(6):
    for d in range(2):
        for q in range(4):
            arima_mod=sm.tsa.ARIMA(df,(p,d,q)).fit(transparams=True)

            x=arima_mod.aic


            x1= p,d,q
            print (x1,x)

            aic.append(x)
            pdq.append(x1)



keys = pdq
values = aic
d = dict(zip(keys, values))
print (d)

minaic=min(d, key=d.get)

for i in range(3):
 p=minaic[0]
    d=minaic[1]
    q=minaic[2]
print (p,d,q)

Where 'df' is the time series data.And the output is as follow,

(0, 0, 0) 1712.55522759
(0, 0, 1) 1693.436483044094
(0, 0, 2) 1695.2226857997066
(0, 0, 3) 1690.9437925956158
(0, 1, 0) 1712.74161799
(0, 1, 1) 1693.0408994539348
(0, 1, 2) 1677.2235087182808
(0, 1, 3) 1679.209810237856
(1, 0, 0) 1700.0762847127553
(1, 0, 1) 1695.353190569905
(1, 0, 2) 1694.7907607467605
(1, 0, 3) 1692.235442716487
(1, 1, 0) 1714.5088374907164

ValueError: The computed initial MA coefficients are not invertible
You should induce invertibility, choose a different model order, or you can
pass your own start_params.

i.e for order (1,1,1) the model is non invertible. so the process stops there.How can i skip such non invertible combination of p,d,q and go on with other combination

like image 381
VINAY S G Avatar asked Jun 17 '15 20:06

VINAY S G


People also ask

What is invertibility in Arima?

Invertibility refers to linear stationary process which behaves like infinite representation of autoregressive. In other word, this is the property that possessed by a moving average process. Invertibility solves non-uniqueness of autocorrelation function of moving average.

How do you know if a model is invertible?

An MA model is said to be invertible if it is algebraically equivalent to a converging infinite order AR model. By converging, we mean that the AR coefficients decrease to 0 as we move back in time.

What is invertible in time series?

A time series is invertible if errors can be inverted into a representation of past observations. For the time series data, the error (ϵ) at time t (ϵt) can be represented as: ϵt=∞∑i=0(−θ)iyt−i.

Is Ma 1 process invertible?

It turns out that any stationary MA(q) process can be expressed as an AR(∞) process. E.g. suppose we have an MA(1) process with μ = 0. It turns out that if |θ1| < 1 then this infinite series converges to a finite value. Such MA(q) processes are called invertible.


1 Answers

Use try: ... except: ... to catch the exception and continue

for p in range(6):
    for d in range(2):
        for q in range(4):
            try:
                arima_mod=sm.tsa.ARIMA(df,(p,d,q)).fit(transparams=True)

                x=arima_mod.aic

                x1= p,d,q
                print (x1,x)

                aic.append(x)
                pdq.append(x1)
            except:
                pass
                # ignore the error and go on
like image 80
fferri Avatar answered Oct 16 '22 11:10

fferri