statsmodels.tsa.stattools.adfuller Regression Results

1,262 views
Skip to first unread message

Keith Jacobs

unread,
Feb 21, 2016, 4:51:23 PM2/21/16
to pystatsmodels
I'm using the Augmented Dickey-Fuller function (statsmodels.tsa.stattools.adfuller).  I'm trying to get it to return the Regression results.  

The arguments passed into the function are: adf = ts.adfuller(x, autolag='AIC', regression='c', store=True, regresults=True).

Instead of getting the results returned, I get <statsmodels.tsa.stattools.ResultsStore object at 0x7ff6fab1b350>. When I try to parse this using str(), I get this error AttributeError: 'ResultsStore' object has no attribute '_str'.

How do I access the Regression results?


josef...@gmail.com

unread,
Feb 21, 2016, 4:57:59 PM2/21/16
to pystatsmodels
The results store instance has the results as attributes, e.g.

results.adfstat
results.usedlag
results.critvalues

dir(results) to see what attributes are available

results.resols is the auxiliary regression that has been used to calculate the adf statistic.

In the source, I see that the pvalue is not attached. That's a bug, and was most likely forgotten to add in a refactor or enhancement..

Josef

Keith Jacobs

unread,
Feb 22, 2016, 1:59:12 PM2/22/16
to pystatsmodels
Thanks for the response.

I'm new to Python.  Do you have any example code that shows how to access the ResultsStore instance?

josef...@gmail.com

unread,
Feb 22, 2016, 2:09:44 PM2/22/16
to pystatsmodels
On Mon, Feb 22, 2016 at 1:59 PM, Keith Jacobs <kjaco...@gmail.com> wrote:
Thanks for the response.

I'm new to Python.  Do you have any example code that shows how to access the ResultsStore instance?

There isn't much more to show (copy pasted from source, I don't have an example right now.) 

adfstat, pvalue, critvalues, resstore = adfuller(x, maxlag=None, regression="c", autolag='AIC', store=True)


resstore.adfstat
...
 

attribute access in Python is with a dot

object.attribute

Josef

josef...@gmail.com

unread,
Feb 22, 2016, 2:16:59 PM2/22/16
to pystatsmodels
except autodoc formatting in new docs is wrong
and there is an incomplete or incorrect description of what's returned for the different options.

Josef

Keith Jacobs

unread,
Feb 22, 2016, 2:31:27 PM2/22/16
to pystat...@googlegroups.com
Thanks for your help. Most of my programming experience has been in C.  I was interpreting the <… object at address…> as the need to dereference a pointer.  From some quick research, I see Python doesn’t really use pointers (or at least not like C).

- Keith



Reply all
Reply to author
Forward
0 new messages