Sunday, November 22, 2009

Dummy Variables

Someone posted/asked:

1. I'm confused about what I'm supposed to be doing with the Dummy Variables. I followed the slides and I got to the point where I'm recoding agegroup into a different variable. But it seems like I'm supposed to be separating the one group, agegroup, into 4 different age groups. So I started transforming 3 into 0, reference group, and so on but that isn't right.

2. Where do I put the c1, c2, c3?

Response:
You're right on transforming! So, you need to recode each age group in order to run the analyzes. It seems like you are lost in the transformation... Let's illustrate the transformation with an example.

Let's say you're running an analysis on how the size of animals (large, medium, and small) predicts their daily diet intake.

So, in your original data set, you have size of animal coded as 1 = small, 2= medium, 3 = large.
Since you can only compare 0 and 1 in categorical regression, unlike gender (male, female), you need to more than one contrast coded predictors. Lecture 12 slide 19 addresses the issue of having multiple levels in one independent variable (IV).
# contrast coding variable = # of levels of the categorical variable examined - 1

In this case, there are 3 levels for size of animal (IV), so, you need 3-1 = 2 contrast coded predictors (aka. independent variables), and I will name the 2 contrast coded predictors as "C1" and "C2".

Let's say I'm going to have "small-sized animal" as the reference group, ie. small = 0, for both C1 and C2.
Then in C1, I will have medium animals as 1, anything not "medium" will be 0.
In C2, I will have large animals as 1, anything not large will be 0.

I will do the following...



So, C1, C2, and C3 are the names for the new predictor variables that will appear on SPSS. You will create C1, C2, and C3 as new variables in SPSS when you're transforming/recoding. Hope this helps.

2 comments:

J. Rehmel said...

So am I creating C1, 2 and 3 as new variables and putting age group 0, 1, & 2 into those respective categories? Does group 3 then get changed to zero or do I just create a reference group variable? That's what it looks like in the slides.

Grace Liu said...

You are right on creating C1, C2, C3 as new variables and assigning age groups to the respective categories!

To answer your second question, "zero" is always the code of reference group. So, whichever age group that Sung asked to you to treat as a reference group should be zero. Hope this is making sense. You're on the right track!