6
$\begingroup$

I'm building a logistic regression, and two of my variables are categorical with three levels each. (Say one variable is male, female, or unknown, and the other is single, married, or unknown.)

How many dummy variables am I supposed to make? Do I make 4 in total (2 for each of the categorical variables, e.g., a male variable, a female variable, a single variable, and a married variable) or 5 in total (2 for one of the categorical variables, 3 for the other)?

I know most textbooks say that when you're dummy encoding a categorical variable with k levels, you should only make k-1 dummy variables, since otherwise you'll get a collinearity with the constant. But what do you do when you're dummy encoding several categorical variables? By the collinearity argument, it sounds like I'd only make k-1 dummy variables for one of the categorical variables, and for the rest of the categorical variables I'd build all k dummy variables.

$\endgroup$

2 Answers 2

9
$\begingroup$

You would make k-1 dummy variables for each of your categorical variables. The textbook argument holds; if you were to make k dummies for any of your variables, you would have a collinearity. You can think of the k-1 dummies as being contrasts between the effects of their corresponding levels, and the level whose dummy is left out.

$\endgroup$
1
  • 1
    $\begingroup$ It would also be sensible to make the value you do not give a dummy variable one of the common and specific answers, e.g. single and female rather than unknown and unknown. Otherwise you may be tempted to report how much impact knowing your marital status or gender has. $\endgroup$
    – Henry
    Mar 9, 2011 at 8:16
0
$\begingroup$

In building logistic regression, you have to bear in mind that the dependent value must assume exactly two values on the cases being processed. In your question , you did not provide enough information on your dependent variable or if you are using binary or multi logistic regression. Nevertheless,if you are using Gender as your dependent variable, then it must assume exactly two values representing male and female, and must not include unknown as you pointed out

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.