# Dummy variables in logistic regression

I'm running a logistic regression for an alumni population to indicate what factors relate to odds of giving. For gender I have a variable that I coded (1,0) so it's binary. If I want to include degrees (i.e. BA, BS, MBA, and PHD) do I create 4 binary variables so that if someone has a BA then they would have 1 in the BA column but 0 for BS, MBA, and PHD? I just want to take sure I code it correctly. Thank you!

Possibly.

You can code highest degree (4 categories) in one of four dummy variables, dropping one in analysis. It is common to use highest degree for people with more than one.

You might want to track people with multiple degrees, eg, both a BA and MBA. If there are a sufficient number, then you can go either of two directions.

One way is to have a category for each combination of degrees (total of 15 since everyone has a degree). Several categories will be empty and you will drop those and one of the categories that has respondents. Some categories might be too small for useful analysis and you might combine some after examining the frequencies.

You could also consider an in-between categorization where you categorize each person in each category for which they have a degree. Some people will be in two categories, some in three, nearly none in four. If there are sufficient numbers of people you should be able to include all four variables in a regression analysis.

I suspect that MBAs are the best givers. You want to capture that kind of information in your coding.

• What do you mean by dropping one in my analysis? – Mike May 4 '17 at 14:01

You can do exactly what you are saying, except that you can (read: should) only use three binary variables if you have 4 levels, or you will create a singular model fit.

What software are you using? This can be easily implemented in R without manually creating binary variables. If you have them coded in R as a character or factor, you don't need to do anything, otherwise, something like this:

m <- glm(y ~ x1 + x2 + as.factor(x3), family = binomial, data = df)

• If I was only using 3 variables but have four levels (BA, BS, MBA, PHD) how would I find the estimate of the variable that I leave out? If I left out BA, for example, and the output showed the estimate BS, MBA, PHD then what could I tell about BA if it's not in the model? I'm using SAS Enterprise Guide but might also use R to check the model. Thanks for the tip! – Mike May 3 '17 at 17:00