# Combining categorical and continuous variables to calculate a factor

I have a categorical predictor (income) and three continuous predictors (area, no. of bed rooms and no of cars). How can I form a single factor from these variables? In other words I want to combine all these variables to get one single variable.

• Why do you want to combine them?
– EdM
Aug 22 '14 at 13:53
• When I use them individually, they are influencing each other in logistic regression, though the VIF is less than 2 for multi-collinearity. So, I want to use calculate a factor to use in logistic regression. Aug 23 '14 at 5:01

If all of them are integer values less than 10, you could use

fac = 100*income + 10*bdrms + cars


Then you'll get 3-digit codes, each digit being the level of the corresponding variable.

Oops, I'm realizing I excluded area. Is that an integer code too? If so, use the same idea with 4 digits. Otherwise, could use

area + fac/1000


and you'll have the 3-digit code after the decimal point and the area before.

Whichever predictor's VIF is 2, and assuming that is the highest VIF, it is not at all high by most people's standards or for most purposes. You may be losing a lot of valuable predictive information by smushing these predictors onto a single scale. In other words the common factor you create will explain fairly little compared to the information uniquely explainable by the individual predictors.

Moreover, one might expect that your reasons for avoiding collinearity would be to allow a better view of the relative contributions of your predictors and more precise estimates of each coefficient. Both of these gains will fall by the wayside if you use only the single combined scale. Remember that there is a tradeoff between reliability and coverage (validity) of scale measures.

If you nevertheless want to create such a scale, you'll first need to convert income into a numeric variable. How that can be done will depend on what categorical values the variable currently takes. There is probably no right or wrong answer; it will be a matter of what is workable or practical, or perhaps what is plausible to your audience.

After that, well, there are a zillion ways to create scales. One fairly "routinized" way would be (purists won't like this) to use principal component analysis or exploratory factor analysis. You could direct the program to create a single factor, and you could use it to automatically save factor scores for each case/observation. This will avoid some of the problems inherent in assigning scores manually, since with the latter methods one may be surprised to find that the predictor with the highest number of different values ends up with the highest weight determining the scale score.

• I agree that combining predictors, even collinear ones, runs too high a risk of losing valuable information.
– EdM
Aug 25 '14 at 14:53