4
$\begingroup$

The logistic regression model is:

$$\log\bigg(\frac{p}{1-p}\bigg) = \ldots$$

The most interesting case (for me) is the case that we have $p=1$ and $p=0$. But in this case, the ratio $p/(1-p)$ doesn't exist

For example: In my model, $p$ is the probability that the customer will come back after the first purchase. We observed that 100% of the clients with the income $> 5000$ euros comes back after the first purchase ($p=1$), and 100% of the clients with the income $< 1000$ don't ($p=0$).

When I treat the income as a continuous explanatory variable, there is no problem (income is a significant variable). But it isn't significant when I segment income into intervals $(0,1000)$, $(1000,3000)$, $(3000,5000)$, $(>5000)$. All the categories become non-significant. I think it's because of the $p=1$ that makes $1-p=0$, then the ratio $p/(1-p)$ is degenerate. What should I do in this case?

$\endgroup$
5
7
$\begingroup$

Even though you should not trust the estimates of 0 and 1 for probabilities (and penalization methods suggested by others are worth doing) there is nothing inherently wrong with them. By all means, avoid categorization of continuous variables which makes things worse in every way. Complete separation is only a problem if using Wald tests and confidence intervals. Use likelihood ratio tests and likelihood confidence profiles for interval estimates and all is well.

$\endgroup$
4
$\begingroup$

I think the confusion here is that you do not apply the logit transformation to your data; it is properly applied to the underlying parameter. (It may help to read my answer here: Difference between logit and probit models.)

Of course, you don't have access to the underlying parameter. If you have multiple observations per study unit, that is, your $Y$ value is a binomial rather than the outcome from a single Bernoulli trial, you could try to estimate it directly from your data. I gather that is what you wanted to try. That is not how logistic regression models are fit, however. Instead, software will search over possible parameter estimates. Newton's method (often called Newton-Raphson), is the most common algorithm. Very roughly, a guess at the appropriate $\hat\beta_j$'s is made, and the predicted probabilities and the joint likelihood of the data conditional on them are calculated. Then the algorithm 'looks around' to see if the fit would be improved by changing the initial guess. If so, the slope estimates are changed and the process is repeated. This will continue until the improvement is less than some threshold.

The fact that in your observed dataset, at the extreme of some variables, there are no 'failures' does not lead to any problems for this method. If you have perfect separation (also called the Hauck Donner effect), that will lead to problems for methods like this, because separation implies the best slope value is $\pm\infty$. For more on that topic, it may help to read this excellent CV thread: How to deal with perfect separation in logistic regression?, or browse some of our other threads tagged with .


Regarding your explicit question of what you should do here, the best answer is not to categorize a continuous variable into intervals. That procedure leads to lots of well-known problems (for some discussion, see here: How to choose between ANOVA and ANCOVA in a designed experiment?). If you don't have access to precise income levels (you didn't bin your data, you were given those intervals), you can try replacing the intervals with their midpoints and using that as a continuous variable. This will lead to some measurement error in your predictor variable / an errors in variables problem, but if the values aren't too far from the true incomes relative to the range of incomes in your dataset, it shouldn't be too bad.

$\endgroup$
-1
$\begingroup$

This is called complete separation and happens when there are combinations of categorical covariates that produce a sample proportion of 0 or 1 in the outcome variable. There is nothing to be done here because it is not possible to estimate the coefficients or their standard errors in the presence of separation. The MLEs for the relevant coefficients/interactions will be $\pm \infty$. I would suggest choosing categories that do not have this problem.

$\endgroup$
1
  • 1
    $\begingroup$ This is a great answer until the last sentence. $\endgroup$ – Frank Harrell May 31 '15 at 22:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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