Coding Categorical Variables Flashcards
What are the 2 ways to code for a dichotomous predictor?
Dummy Coding & Effect Coding
What are the differences between ways to code for dummy and effect coding?
Dummy code is 1 and 0 and Effect code is -1 and 1.
They serve different functions.
What is 0 considered in dummy coding?
Is there a reference group in effect coding?
0 is the reference group.
There’s no reference group in effect coding.
When we are looking at sex differences between GRE scores, what type of information do we need?
Male mean
Female mean
Grand mean
How do we set up dummy code on r?
Instead of computing statements, we use contrast statements to set-up dummy codes.
From the output in r, what will the estimate of the intercept always be when we dummy code?
What will the b1 coefficient be?
The estimate of the intercept will always be the mean of the reference group (0).
The b1 coefficient will be the difference between the reference group and 1.
ex) b0 = 585
b1 = -10
-10 is the difference between the mean of 585 and female score of 575.
From the output in r, what will the estimate of the intercept always be when we effect code?
What will the b1 coefficient be?
The b0, or intercept will be the Grand mean of the Equal group sizes.
b1 coefficient is the difference bw Male Mean and Grand Mean
ex) b0 = 580
b1 = 5
How do we do an equation for dummy codes?
How do we interpret the coefficients?
We will be plugging the 0’s and 1’s into the difference of means starting with the reference group.
ex) yhat = b0 + b1D1 + b2D2 + b3D3 + b4D4
b0 is the mean of the reference group
b1 – difference between mean of interest group and reference group mean… so on and so on.
The intercept of effect coding gives us _________.
The coefficients are the difference between __________ and __________.
the Grand mean
the coefficients are the difference between the Grand Mean and the mean of the group we are interested in (first group).
For equal n dummy coding, how many code vectors are required?
Multiple coded vectors, where coding vectors = # of categories - 1.
How can we apply ANOVA type partitioning to Effect coding? Conceptually, this shows that ANOVA and regression are pretty much the same.
The structural model is similar in that Y = GM + unique + error.
Each subject’s score includes contribution of the overall score, treatment effect, and error.
Overall = grand mean
Treatment effect = the effect of 1 coefficient
Error = the residual
What are examples of categorical groups?
Ethnic groups
gender
SES
When would we use effect coding over dummy coding, and vice versa?
Effect coding will be used if we are looking at the effects of each group.
Dummy coding to look at how each group varies compares to our reference group.
What type of mean is now added for unequal n?
The average mean, which is the difference of
What’s the difference between grand mean and average mean (unequal n)?
The grand mean is the total number of scores we have divided by the total number of n.
The average mean divides the total mean scores by the number of mean scores.
When the data are unbalanced (unequal n), how do the coding of vectors and interpretation of output from (1) dummy coded, (2) effect coded, and (3) orthogonally coded analyses differ (from the equal n case)?
Nothing changes for dummy coding, we interpret it the same as we did for equal n.
However, for effect coding, IF THE EFFECT CODE STAYS THE SAME (-1 and 1) Interpretations change; the intercept is no longer the grand mean, now it’s the unweighted Average Mean of the group. The coefficients will be the Difference of the Group mean and the Average mean.