Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
ARIMA function in statsmodels.tsa.arima_model module is giving error.

I am running a ARIMA model to predict prices.
I am importing the statsmodels package as:
'''import statsmodels.tsa.arima_model as tsm''' and calling the function "tsm.ARIMA" to fit a model. I keep getting the error:-- " AttributeError: 'module' object has no attribute 'ARIMA' ".
I had earlier ran the same code on ipython3 notebook by callling zipline and statsmodels packages and it ran perfectly fine outputting the portfolio results. Why does this error occur in quantopian? Also I tried to find the attributes of the "tsm" module using the "dir()" function but it is not functional in quantopian due to some security concerns.
How else do I get to know the attributes present in a module in quantopian?

12 responses

Hi Arjun,

On Quantopian we're running an older version of statsmodel, which is why you're receiving the error on our platform but not in Zipline. You can use the ARMA module on Quantopian by importing "from statsmodels.tsa.arima_model import ARMA". We always try to stay up-to-date with the latest packages and thoroughly review them prior to making our updates.

Best,
Alisa

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Alisa,

Arjun asked about ARIMA, but you talk about ARMA. ARIMA does not appear to work on quantopian when I try to use it the same way as ARMA, I get a "Runtime exception: TypeError: cannot concatenate 'str' and '__builtins__.Security' objects" error. Any suggestions?

Ah, good catch!

I looked at ARIMA, and we need to update our statsmodels package to support the function. Once we do so, it will be available in the IDE.

Hi Alisa,

What's the current version supported by Quantopian? I've got the same problem

Thanks

We're running statsmodels version 0.6.1

Hi Alisa

I am struggling with a similar issue on the Research platform - see attached notebook.

I have the exact same problem:

import statsmodels.api as sm

sm.graphics.tsaplots.plot_acf(data.SPY.values)  

SecurityViolation: 0002 Security Violations(s): Accessing sm.graphics raised an AttributeError. No attributes with a similar name were found.

Same error as Erich using sm.tsa.ar_model.AR()

Hi folks,

The ARIMA module is available in the IDE and you can access it via:

import statsmodels.tsa.arima_model  

In the research environment, the graphics submodule is not currently supported. Thanks for the request and we'll take a look at the package. When it becomes available, we'll let you know.

Alisa

Thanks! I will stab at that one.

Hello All -
Could someone guide me on how to display/plot the autocorrelation function and partial autocorrelation function?
Then, apply the arima function on a specific security for price prediction for say 10 periods?

Also, is there a function in python which is similar to auto.arima in R which selects optimal arima model?

thanks!

Hi Alisa,

Having issues importing HP Filter from statsmodels...Tried a few different ways to import (using statsmodels documentation and the advice above), but still having issues. Could you provide guidance?

Just trying to run the following line of code:

cycle, trend = sm.tsa.filters.hpfilter(Dividend_List,1600)  

Error is as follows:

SecurityViolation: 0002 Security Violations(s): Accessing sm.tsa raised an AttributeError. No attributes with a similar name were found.

Thanks!