# What can cause a “wrong” sign coefficient in a logistic regression?

I have the variable AGE in my logistic regression to explain the probability of default of a customer. I'm trying to explain the probability of a customer not paying us. I know that I have 100,000 customers in each range.

This is my historical information:

• Among customers more than 18 years old and less or equal then 21 years old 30,000 paid us, and 70,000 didn't paid us.
• Among customers more than 21 years old and less or equal then 23 years old 40,000 paid us, and 60,000 didn't paid us.
• Among customers more than 23 years old and less or equal then 26 years old 60,000 paid us, and 40,000 didn't paid us.
• Among customers more than 26 years old and less or equal then 29 years old 80,000 paid us, and 20,000 didn't paid us.

However, when I run the regression, I have positive coefficients for all ranges. Even though the coefficients decrease when ranges have higher limits, they are still positive. I don't have any significant correlation. Are the coefficients wrong? What could be happening?

My dependent variable, is the event of default(customer does not pay).

• What's your intercept? I bet it's negative. – Ben Ogorek Apr 25 '16 at 19:44
• Is it a coincidence that each group has exactly 100k observations? What is the base level? – Matthew Drury Apr 25 '16 at 19:44
• You might want to check out Simpson's paradox: en.wikipedia.org/wiki/Simpson%27s_paradox – Vishal Apr 25 '16 at 19:51
• I'd also check to ensure your coding of the outcome variable is correct, and that it isn't reversed for the program you're using. – Ashe Apr 25 '16 at 19:58
• @Ashe was asking about the coding, not the code. The coding is essentially which level of your factor variable is the base level, which will receive a zero coefficient from mathematical neccesity. All the other coefficients much be interpreted relative to the intercept. – Matthew Drury Apr 25 '16 at 20:05

Based on what I'm hearing, everything is as it should be. Recall that a logistic regression model takes the form $$\log(p/(1-p)) = \text{intercept} + \beta_1 * x_1 + \ldots \beta_p * x_p.$$
When $p = .5$, the left hand side is $log(1) = 0$. If the event is rare, then the left hand side is negative. A large negative intercept mixed with smaller positive contributions from the regressors can still result in a negative log odds prediction and hence a small estimated probability. Since your regressors are class variables, one of them must be the baseline. All other coefficient values are relative to that one so you may want to look into which category your software chose as baseline.