# How to handle and test categorical dummy variables when interested only in certain levels?

I want to build a multiple linear regression model.
I want to test the effect of a nominal variable with 10+ levels, but I am interested in testing only the effect of 2 of them.

1st Question: How should I include the variable in the model?
My proposals:

• I can exclude the non-interesting observations from the data set (it is very large), thus transforming the nominal variable into a binary one
• Alternatively I could code it as two (k-1) dummy variables, labelling all the other levels as "other"

2nd Question: How to test and interpret their significance?

• If i turn it into a binary variable by filtering the data set, how do I test and interpret the effect of the level which takes the value of 0?

I think I should use an F-test but I have some control variables (all categorical as well), so I am not sure how would the interpretation of the constant work in that case.

Note: the model has target age as dependent variable. The categorical variable is acquisition reason. I am trying to predict target age according to the takeover purpose of the buying company.

I can exclude the non-interesting observations from the data set (it is very large), thus transforming the nominal variable into a binary one

This is a possibility, but it all depends on the data which you will be discarding, and whether you will still have a representative sample across the dependent and independent variables. Without seeing the dataset, it is not possible to evaluate this qualitatively.

Alternatively I could code it as two (k-1) dummy variables, labelling all the other levels as "other"

While the dataset is very large, this depends on the proportion of your binary variable if you were to proceed with this course of action.

For instance, if you end up with a situation where 85% of the variable is comprised of 0s and 15% are 1s, then the model could still suffer from overfitting.

If i turn it into a binary variable by filtering the data set, how do I test and interpret the effect of the level which takes the value of 0?

If the observation takes a value of 0, then the value of the coefficient will also be 0, i.e. coefficient*0 = 0

This would mean that for every 0 in the dataset (holding the other variables constant), the value of the dependent variable would decrease.

However, you need to be careful. While labelling all data as "other" can facilitate you in testing the effect of the two levels of interest, your regression results could be skewed if the remaining levels are significantly different but being placed under the one label.

To start with, I would be inclined to run a regression using only the two levels of interest, and then compare this with the regression results run on all of the data. This might give you a better indication as to how to proceed.

• Thank you, Michael. I will try proceeding as you suggested and see what comes out of it. I will leave the question as open for now just to see if also other users have interesting inputs. p.s.: I am the original poster of the question but I think messed up during the signing up process. – Federico Jan 1 at 19:10
• No problem, Federico: just visit stats.stackexchange.com/help/merging-accounts to merge your accounts. – whuber Jan 1 at 20:45