8

I have a statsmodels.discrete.discrete_model.BinaryResultsWrapper that was the output of running statsmodels.api.Logit(...).fit(). I can call the .summary() method which prints a table of results with the coefficients embedded in text, but what I really need is to store those coefficients into a variable for later use. How can I do this? The documentation is not really clear on how to do this very basic operation (probably the most basic thing anyone would want to do with the results, besides print them)

When I try the fittedvalues() method, which looked like it would return the coefficients, I just get the error:

'Series' object is not callable

cas5nq
  • 413
  • 5
  • 11

1 Answers1

7

Since the documentation is poor, I found the solution through random experimentation.

The correct syntax is:

Logit(...).fit().params.values
cas5nq
  • 413
  • 5
  • 11
  • http://statsmodels.sourceforge.net/stable/generated/statsmodels.discrete.discrete_model.LogitResults.html It's a bit messy, but the documentation for the Results has the list of attributes. – Josef Apr 25 '15 at 19:09
  • What confused me was that 'params' was listed as a 'Parameter' and not an 'Attribute' as is standard notation for Class documentation. A parameter is typically an argument or input to a class constructor or method, not an attribute to be invoked with dot notation. – cas5nq Apr 25 '15 at 19:23
  • Yes, I didn't see this before, something is messed up with sphinx documentation creation. Things like this should be reported on the statsmodels issue tracker so it gets fixed. – Josef Apr 25 '15 at 20:27
  • Eight years later, this was not fixed. – HAL Jan 27 '23 at 05:51