Let's say I have two variables, X and Y and want to build the model Y ~ X
. Y can be a boolean or a continuous variable. X is a continuous variable. I want to turn X into a categorical variable either by making it a boolean or binning it.
However, I do not want to arbitrarily bin it (based on even intervals, quantiles, etc...) or just picking a single threshold (to create a boolean). Instead, I want stats or ML to pick the thersholds for me.
I've heard you can look at inflection points using a partial dependence graph, but that doesn't make sense to me as I don't want to spend the time building a complex machine learning model just to determine thresholds.
Is there a technique based off ANOVA that we could use to do this. For example, find the thershold that maximizes the difference in group means. This should automatically factor in the sample size of the two groups (to get statistical significance), and if that doesn't work, I'll just set a constraint on the sizes of the two groups.
For example let's say I just want to divide X into two categories. This is basically a one-way ANOVA problem. I want to find the two categories so that the statistical significance of the difference in group means is maximized. Basically find the threshold that maximizes the F-value. Is this even a statistically sound method to use? Is there a name for this? I can probably code something up to find the threshold.
If there's no major flaws with the method, I could just create a grid of values [0, 0.1, 0.2, etc...], do an ANOVA test and log the F-values, then find the threshold with the highest F-value...