简体   繁体   中英

How to get the coefficients from an MLE logit regression?

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

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

The correct syntax is:

Logit(...).fit().params.values

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM