# What are the pitfalls of including a continuous variable and a discretized version of the same variable within a regression?

Besides the issue of collinearity - making coefficients kinda useless and p-values non interpretable, I was wondering, what would be the issue of including a continuous variable and the discretized version of that variable in the same model?

For example, let's say X1 is continuous. I want to include a categorical variable, X2, where X2 is the quartiles of X1. The reason for this is, I want to use X2 to interact with other categorical variables in the model, as opposed to X1.

I'd imagine the upside of doing this is, more observations for the interaction term itself. I also have the hypothesis, that maybe the 4th quartile has an especially strong interaction effect with other variables, as opposed to the other 3 quantiles - and I want to bring out the effect of that quartile.

My goal here is to improve prediction accuracy, and the coefficients themselves aren't as important. The only important thing about the coefficient is if the sign is positive or negative. I know for a fact X1 is significant based on the data I am working with.

• It's probably a waste of information. Your model can be characterized as including $X_1$ as a "discontinuous linear spline of constant slope." It requires 4 parameters (assuming there's an intercept already in the model). With this many parameters you could use, say, a quadratic spline and identify a breakpoint (if you really believe there are any discontinuities). In short, instead of asking whether this approach might possibly work, think about what is meaningful to accomplish in your application with the four parameters you're willing to expend on $X_1.$
– whuber
Feb 25, 2021 at 18:05
• Thanks! In reality, I'm probably more interested in just the 4th quartile as opposed to all 4 quartiles so it would increase the model by one dummy. I was just wondering if there were any huge pitfalls of doing this when ultimately the goal is prediction and secondary is interpretation of coefficients. Unfortunately, I need the original variable X1 in the model for sure, as that's how things have been done previously, and it'll be tough to explain why I changed it/removed it for something else. Feb 25, 2021 at 18:09
• The more parameters you include, the greater your risk of overfitting. That's one reason it's worth paying attention to how many parameters you use.
– whuber
Feb 25, 2021 at 18:12
• If the goal is prediction, you could really use any transformation or combination. (say at the extreme use every value of your variable x1 as a dummy). The problem there will be, how do you know if the improvement for the in-sample prediction will improve out of sample prediction (the one you should care about). One option...Cross-validation. This is related to @whuber "overfitting" problem. Feb 25, 2021 at 18:13
• Yes, that's always possible.
– whuber
Feb 25, 2021 at 18:18

I would say that in principle there is no problem at all. You are simply making a different set of assumptions regarding the functional form.

For instance, rather than modeling as:

$$y=a_0+ a_1 * x + a_2 *z+e$$

you are modeling:

$$y=a_0+ a_1 * x + a_2 *z + a_2 *z * 1(x>0)+e$$

So a different model that is, perhaps more flexible. The problem I would say, is how to estimate marginal effects.

Consider a simpler model:

$$y=a_0+ a_1 * x + a_2 * 1(x>0)+e$$

So $$X$$ enters linearly, and as a dummy. So lets assume that this is indeed the Population model. The question is, how do you obtain (and what do you report for the marginal effects of $$X$$?

$$\frac{\partial y}{\partial x} = a_1$$ for any values below or above 0, but $$\frac{\partial y}{\partial x} = a_1 + a_2$$ For values exactly at 0 (technically just below.

So what do you do? what do you report as an average marginal effect? or do you report at specific values?

I think this is the biggest problem here. HTH

• I'll probably just explain that the coefficients and p-values may not be accurate. My final model will have many variables and I know some will be correlated with each other - I was hoping that's good enough of an argument to keep them in the model even though p-values may not be significant. For those with high p-values, I plan to do a simple regression to show that on a standalone basis, it is significant. Unless the two variables are extremely related - I plan to do some Chi2 tests of independence or correlation tests, I was thinking of just keeping then in the model. Feb 25, 2021 at 18:13
• Why do you care about significance if you intend to use the model for prediction? Feb 25, 2021 at 20:54