Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 208
cas5nq Avatar asked Apr 25 '15 18:04

cas5nq


People also ask

How do you find the coefficient in logistic regression?

For a sample of size n, the likelihood for a binary logistic regression is given by: L(β;y,X)=n∏i=1πyii(1−πi)1−yi=n∏i=1(exp(Xiβ)1+exp(Xiβ))yi(11+exp(Xiβ))1−yi.

Does logistic regression have coefficients?

Logistic regression coefficients also correspond to marginal effects, but the unit of measurement is not test points or whatever; instead, the unit of measurement is log odds, and and a 1-point increase in log odds is difficult to put in context.

What does the coefficient mean in logit regression?

The logistic regression coefficient β associated with a predictor X is the expected change in log odds of having the outcome per unit change in X. So increasing the predictor by 1 unit (or going from 1 level to the next) multiplies the odds of having the outcome by eβ.

Which method is used to find best coefficients logistic regression?

Just as ordinary least square regression is the method used to estimate coefficients for the best fit line in linear regression, logistic regression uses maximum likelihood estimation (MLE) to obtain the model coefficients that relate predictors to the target.


1 Answers

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

The correct syntax is:

Logit(...).fit().params.values
like image 111
cas5nq Avatar answered Oct 21 '22 14:10

cas5nq