1

I am using logistic regression to predict the probability of being a bad customer. I need to transform each independent variable to make sure it has a strong linear relationship with the log-odds of my target. One variable has a upper U-shape when I plot the variable value against the log-odds. How should I transform it so I won't over-predict the lower group and under-predict the upper group?

enter image description here

EDIT: I tried using square, but it did not give me a better/linear-er line. enter image description here

skylar1218
  • 21
  • 2

2 Answers2

3

No transformation is necessary to achieve linearity, because that isn't required. You simply have a curvilinear relationship between this variable and the outcome. So add a squared version of this variable in addition to the untransformed version. If you need a test of this variable, you would perform a simultaneous test of both terms.

It may help you to see a couple of my previous answers where this is demonstrated (in R):

gung - Reinstate Monica
  • 132,789
  • 81
  • 357
  • 650
2

You can use a spline of the independent variable. These allow very flexible fitting of almost any shape of relationship between the IV and the DV (or, in this case, the log odd of the DV).

Peter Flom
  • 94,055
  • 35
  • 143
  • 276