11. Effects Coding (Sum to Zero) Flashcards
What is effects coding?
Assign different weights to certain levels of a categorical variable
What is the issue of under identification?
Need a reference group as we want a model that represents our data but we have more parameters than group means so need to estimate with one parameter less as otherwise we are estimating too much with too little
What fixes the issue of under identification?
Constraints (Sum to Zero)
Reducing parameters mean we can estimate categorical models
What would our coefficients look like if one of the IVs was a reference group? (Use hospital example)
Treatment A = B0
Treatment B = B0 + B1
Treatment C = B0 + B2
What would our coefficients look like if we were comparing against the grand mean?
yij = μ + βj + ϵij
where
yij is the score for a given individual (i) in a given group (j)
μ is the grand mean
βj is a group specific effect
ϵij is the individual deviation from the group mean
So group mean =
mean - grand mean
Sum to Zero constraint: This means sum of all the coefficients would be equal to zero
Why do we not want to use dummy coding all the time?
Can compare grand mean/overall mean
Group 1 vs Group 2,3,4
How do you create a contrast matrix?
Focal group = 1
Observations in last group = -1
For all others in group = 0
Create k-1 variables
What is the code used for effect coding in r and how does it differ to dummy coding?
contr.sum for effect coding compared to contr.var for dummy coding
Should produce the same outcomes in anova
How would you calculate the dropped variable from the interpretation?
beta 0 - (beta 1 + beta 2)