How to make SalePrice as a discrete value?

The target variable, Saleprice originally is a continuous value. I calculated feature importance on the other variables except Saleprice and got a ranking of the features.

My teacher said that I do not allow the target variable, Saleprice to be explored as the other variables. As Independent variable is used to predict SalePrice which is the target variable. Target variable can be treated as a dependent variable because it depends on the independent variables.

She suggested to use I can explore Saleprice because it is a continuous variable to binning method, for example binning Saleprice from 100k to 150k . The range can be regarded as a single value. (treated as a discrete value)

May I know how should I apply the binning method on Saleprice to make it as a discrete variable?

and

how does that being a discrete variable can help me better in building of model and prediction of Saleprice?

Dataset I just use the train data only.

• If you're asking how to bin a variable in particular software, that's off-topic here and in any case variables can be binned in many different ways. The deeper question here is whether it helps to bin sales price. It's hard for me to see why throwing away information can help in any way in prediction. – Nick Cox Jul 30 '19 at 9:21

Unless there is stuff you aren't telling us, the answer is "you shouldn't do this". Binning the DV will increase both type I and type II error. It also invokes a kind of "magical thinking" - that something magical happens at the breaks.

Now, if you are in an introductory class in statistics, it might be that your instructor is telling you to do this because she doesn't want to get into things like splines. EDIT: For instance, suppose your teacher suspects there is a nonlinear relationship between one or more of the IVs and the DV. One method would be to use a spline of the DV (it's more common to look at splines and cutpoints of IVs, but you can model a spline of the DV, e.g in PROC TRANSREG in SAS).

Or it might be that your teacher doesn't know what she is doing - that is unfortunately common if the instructor is in some department other than statistics.

Or it might be that she has something else in mind.

But it's not good advice to bin a continuous variable, unless there is some strong substantive reason for doing so.

• Could you elaborate a little on how splining and binning might be considered related procedures for modeling a dependent variable?? – whuber Jul 30 '19 at 12:27
• Thank you: a look at the SAS docs indicates what you really mean is using a spline to effect a nonlinear transformation of the DV (which is very different from binning it!) Since splines of IVs are used to create multiple explanatory variables, the meaning was obscure. – whuber Jul 30 '19 at 21:34
• I am implementing this in Python. I previously did feature selection and have come up with a list of features (IVs) to build the regression model to predict SalePrice. However, I still do not understand why SalePrice have to be binned to become a discrete variable. How will being a discrete variable help in the regression model and prediction? – takahashi Jul 31 '19 at 3:26
• No one who has answered or commented understands either. Surely the next step is to ask your teacher why she recommends this. FWIW, I can see much point in working with say logarithm of price but that is not binning. – Nick Cox Jul 31 '19 at 8:05