# Categorical vs Continuous Variable

I have two variables, one continuous and one categorical which I currently both use as predictor variables in a logistic regression model.

Their relationship is shown in the following plot with the x axis showing the different categories of the categorical variable and the y axis showing the values of the continuous predictor variable. Being quite new to statistics in general, I wonder if one can make general statements as to whether one should only use the categorical, only the continuous variable or whether in some situations it still makes sense to use both variables even if they are clearly correlated as in the plot above.

• I think is hard to tell wether you should use one or both without knowing anything else about the context of the analysis. There might be very good substantive reasons for including both in the model. On the other hand, you want to avoid collinearity between your predictors, and if that is an issue then you could justify using only one of them based on that. – David May 21 '13 at 23:01
• An answer would in part depend on their relationship to the response. – Glen_b May 21 '13 at 23:28
• The categorical variable looks very suspicious, not because it's missing "J", but because the whiskers do not overlap at all, which prompted me to think that the categorical one is just a regrouped version of the continuous one. If that's the case, it's quite unlikely that both of them will be retained, because the continuous one is likely going to knock the categorical one out: the categorical is less predictive to begin with, and it takes whopping 11 degrees of freedom (12 if the blank one is real). If they are different things, then as the comments above said, we will need to know more. – Penguin_Knight May 22 '13 at 2:55
• @Penguin_Knight Yes you are right, I should have mentioned that the categorical variable is indeed a partition of the continuous variable. Even then it wasn't clear to me that it is obvious one can drop it. Thank you – user695652 May 23 '13 at 20:46

## 1 Answer

As it became clear in the comments that the categorical variable just was a binning of the continuous one, the answer is clear: Only use the continuous variable as a predictor.

But beware: assuming that a continuous variable acts linearly in logistic regression, is a strong assumption, so model it with a regression spline, see Logistic Regression with regression splines in R.