2
$\begingroup$

I ran a logistic regression, where my independent variable is a categorical one with 20 distinct determinations (which could lead to both 0 and 1 in my dependant variable).

I guess that in this scenario the estimation of the coefficients could not lead to different results than the simple ratio observed in the sample (after converting into probabilities), so basically it was just an exercise to me.

But then I noted something little unclear: the LLR p-value is exactly 1, and on the other side all the coefficients except one have p-value = 0.

In a previous phase I ran a chi-squared test for independency and I had a very low p-value.

How should I interpret my results?

Dep. Variable:  lead             No. Observations:  256643
Model:  Logit                    Df Residuals:  256622
Method: MLE                      Df Model:  20
Date:   Tue, 12 Nov 2019         Pseudo R-squ.: -0.3543
Time:   14:52:23                 Log-Likelihood:    -26658.
converged:  True                 LL-Null:   -19683.
Covariance Type: nonrobust       LLR p-value:   1.000

About the data: the classes are heavy unbalanced, in fact the class '1' is around 1% of the total. I know that some resampling techinques are needed in a further phase, as adding more variables to my model, my question is simply about the interpretation of this phenomenon.

$\endgroup$

1 Answer 1

1
$\begingroup$

I had the same issue, but finally the problem with my model specification was that it did not include the intercept (statsmodels does not use interceptby default like it's none in R), which influenced model's likelihood. Adding the intercept

X_train['intercept'] = 1
X_test['intercept'] = 1

fixed the issue in my case.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.