# Quant analytic: Best method to transform a continuous variable to categorical variable in order to build a logistic regression model?

(Last Updated On: March 8, 2012)

Quant analytic: Best method to transform a continuous variable to categorical variable in order to build a logistic regression model?

==

Which logistic regression model do you intend to use? If binary logistic: just decide on a cut-point which separates the two categories. In SPSS, you can use the recode method which is available on the Transform menu, or do it via syntax.
If you create more than two categories, you might look at ordinal regression, which is an extension of the binary logistic model, but quite challenging to interpret. I assume your categories would be ordered, so in a multinomial logistic model you would lose part of the information contained in the data.

==

I would urge caution and recommend you reconsider whether you want to really want to “bin” your continuous outcome variable.

Logistic regression is best applied when the two outcomes reflect distinct states (for example, has diabetes vs. does not have diabetes). If you took a continuous variable, like income, and binned it to “over \$40k” and “\$40k or less” you really don’t have distinct states … the difference between \$39,999 and \$40,001 is trivial.

If you are struggling with a skewed outcome variable, I recommend you consider these two alternatives before resorting to binning it:
(1) Use a generalized linear model and select an appropriate distribution (Poisson and Gamma are quite popular); or
(2) Try transforming your outcome variable (such as a log transformation) to see if that makes it “more normal”.

==

==

You can generate a seq of cut-off points and then try to separate the continuous data to binary using the cut-off. Based on each logistic regression, calculate the AUC. Find the highest AUC and the corresponding cut-off. I think that cut-off may be the optimal one to classify your data into binary.

==
i don’t understand how to use a generalized linear model sutch us poisson or Gamma to bin continuous variable can you give a simple example if you want.

==

I was suggesting consider using a generalized linear model instead of binning — not as a method to create bins. Sorry for the misunderstanding.

==

I wouldn’t recommend doing that. Why would you want to lose richness of data that have been collected using a ratio scale by downgrading it to data using a categorical scale. It might be better to run linear or non-linear regression and thus retain the robustness of the data you’ve collected. I’d recommend looking at various bivariate scatter plots (two-dimensional plots between the dependent variable and each of the independent variables, one by one), as the first step, to understand the nature of relationship, and then chose an appropriate regression model accordingly. … But if for any reason, you must want to change the dependent variable to categorical scale, you could just follow a simple step. Classify the independent variable data into intervals, examine the frequency distribution to look for distinct concentrations or groupings. Choose cut-off points as appropriate and combine the intervals into groups accordingly. Assign a value to each group, and what you now have is a categorical scale. Hope this helps.

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

## Still hungry? Here’s more

### Unleash the Power of Automated Trading (No Coding Required!)

What if there was a way to harness the power of automation, freeing you to focus on your goals while your trades execute with precision? Enter the world of automated trading, a revolutionary approach accessible even to those with no coding expertise.

### Bitcoin Rebound as War Fears Subside, Bullish Technicals Ensue

Bitcoin rebound, the undisputed king of cryptocurrencies, has staged a remarkable comeback in recent weeks, defying predictions of an extended slump triggered by the Russia-Ukraine conflict.

Are you interested in:

• Geting My Quick FREE Daily Trading Plan Videos
• See my daily MACHINE LEARNING analysis what my system tracks
• Short term trading opportunities with maximum return potential
• There are 11 tips you need to know how your broker is screwing you to lose.
•  Open source automation  and  Excel add in with 300+ technical analysis indicators

# FREE 2 Hour Video!

As you know with the crazy restrictive emergency laws being introduced in the last week, many moving their savings out of FIAT banks into cryptocurrency trading.

Here are some questions to get your started:

• Create your own ‘bank’ anonymously with crypto
• In the future, draw off your crypto saving with a Visa debit card
• Trade using a European de-central exchange to trade perpetual contracts and other high performing coins
(All your info is kept private nor released!  Don’t forget to check to click your promo or spam inbox after the confirmation email is sent)