sm.tsa.ARMA making ma invertible

3,110 views
Skip to first unread message

Sudheer Joseph

unread,
Aug 20, 2013, 12:09:41 PM8/20/13
to pystat...@googlegroups.com
Hi,
I am using statsmodels .6 version and python 2.7.3
 I was trying to fit an AR2MA2 model for my time series data and I get below error while fitting ar2ma2 model while there is no issue if ar2ma1 or ar3ma3 etc.
when I try ar2ma2 and ar3ma2 I get below error

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.

Can some one advice me what exactly the issue is and how to make the MA coefficient invertible?.

 I tried to do the same with R I get coefficients with out issue. So I assume R has an automatic way of making the MA coefficients invertible.
I need to stick to python for other reason as I use daily time series.

with best regards,
Suheer

Skipper Seabold

unread,
Aug 20, 2013, 12:27:59 PM8/20/13
to pystat...@googlegroups.com
On Tue, Aug 20, 2013 at 12:09 PM, Sudheer Joseph <sjo....@gmail.com> wrote:
Hi,
I am using statsmodels .6 version and python 2.7.3
 I was trying to fit an AR2MA2 model for my time series data and I get below error while fitting ar2ma2 model while there is no issue if ar2ma1 or ar3ma3 etc.
when I try ar2ma2 and ar3ma2 I get below error

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.

Can some one advice me what exactly the issue is and how to make the MA coefficient invertible?.

This usually, though not always, indicates that the model is mis-specified. Did you try what the error message says -- either fitting a different model order or using start_params?
 

 I tried to do the same with R I get coefficients with out issue. So I assume R has an automatic way of making the MA coefficients invertible.
I need to stick to python for other reason as I use daily time series.

It's possible that the coefficient from R may be garbage. What are the roots of the MA parameters from R?

I would see what you get using different software - e.g., Gretl, Stata, or X-12-ARIMA. My experience has been that they will likely all be different, though gretl will usually give you a heads up that something is wrong post-estimation or will refuse to do the estimation.

Skipper

josef...@gmail.com

unread,
Aug 20, 2013, 12:30:10 PM8/20/13
to pystatsmodels
On Tue, Aug 20, 2013 at 12:09 PM, Sudheer Joseph <sjo....@gmail.com> wrote:
Would you please open an issue for this
https://github.com/statsmodels/statsmodels/issues?state=open ?
Can you share the data, so we don't have to figure out how construct a
dataset that can trigger this?

I think if only the MA coefficients are not invertible, and the AR
coefficients are stationary, then we should be able to continue with
the estimation.
In contrast, non-stationary AR coefficients could indicate that the
model is not appropriate and needs to be differenced, for example.

For now I only see giving your own starting values as a solution.

(There is a function to invert MA coefficients in statsmodels.tsa
somewhere and it's not in the documentation.)

Josef

>
> with best regards,
> Suheer

josef...@gmail.com

unread,
Aug 20, 2013, 12:33:56 PM8/20/13
to pystatsmodels
That's true for the AR part, but IIRC, invertible and inverted MA
coefficients are observationally equivalent.
(but it has been a long time since I went through this)

Josef

>
> Skipper

Sudheer Joseph

unread,
Aug 20, 2013, 10:33:46 PM8/20/13
to pystat...@googlegroups.com
ruts.npy
test.py
rus.nc
ru_ts.r

Sudheer Joseph

unread,
Aug 20, 2013, 10:38:27 PM8/20/13
to pystat...@googlegroups.com
Thank you Both Josef Skipper.
                                                  In my last post where I attached the files I could not write as this text box got hanged. I have attached here the python script where the problem is there and the R script which works with the same data. Please tell me if there a way to make ma invertible. Also what is meant by providing initial parameters? How do we specify that?. 
Another question I had was. In case of MA2 is it possible to fit only Ma2 with out Ma1?. In that case how it can be specified to arma?

with best regards,
Sudheer

Skipper Seabold

unread,
Aug 20, 2013, 10:59:09 PM8/20/13
to pystat...@googlegroups.com
On Tue, Aug 20, 2013 at 10:38 PM, Sudheer Joseph <sjo....@gmail.com> wrote:
Another question I had was. In case of MA2 is it possible to fit only Ma2 with out Ma1?. In that case how it can be specified to arma?

No, this is not possible yet. I started to add this functionality, but at the time it wasn't clear to me how to do this in such a way that doesn't affect performance. Open to contributions here, because I won't have time for the foreseeable future.

Skipper

Reply all
Reply to author
Forward
0 new messages