8
$\begingroup$

I'm seeking your help in understanding the difference between two different contrasts for dichotomous variables.

On this page: http://www.psychstat.missouristate.edu/multibook/mlt08.htm under "Dichotomous Predictor Variables", there are two ways to code dichotomous predictors: using the contrast 0,1 or the contrast 1,-1. I kind of understand the distinction here (0,1 is dummy coding and 1,-1 adds to one group and subtracts from the other) but don't understand which to use in my regression.

For example, if I have two dichotomous predictors, gender (m/f) and athlete (y/n), I could use contrasts 0,1 on both or 1,-1 on both. What would be the interpretation of a main effect or an interaction effect when using the two different contrasts? Does it depend on whether my cells are of different sizes?

$\endgroup$
13
$\begingroup$

"Dichotomous Predictor Variables", there are two ways to code dichotomous predictors: using the contrast 0,1 or the contrast 1,-1.

This is factually wrong. There is no limit to the number of ways they can be coded. Those two are merely the most common (indeed between them, almost ubiquitous), and probably the easiest to deal with.

I kind of understand the distinction here (0,1 is dummy coding and 1,-1 adds to one group and subtracts from the other) but don't understand which to use in my regression.

Whichever is more convenient/appropriate. If you have a designed experiment with equal numbers in each, there are some nice aspects to the second approach; if you don't the first is probably easier in several ways.

For example, if I have two dichotomous predictors, gender (m/f) and athlete (y/n), I could use contrasts 0,1 on both or 1,-1 on both.

What would be the interpretation of a main effect or an interaction effect when using the two different contrasts?

a) (i) Consider a gender main effect (without interaction for simplicity) {m=0, f=1} - then the coefficient corresponding to that dummy will measure the difference in mean between females and males (and the intercept would be the mean of the males).

(ii) For {m=-1, f=1} the gender main effect is half the difference in mean, and the intercept is the average of the means (if the design is balanced it is also the average of all the data). Equivalently, the the main effect is the difference of each group mean from the intercept.

b) (i) consider an interaction between gender{m=0,f=1} and athlete {n=0,y=1}

Now the intercept represents the mean of the male non-athletes (0,0), the gender main effect is the difference between the means of the female non-athletes and male non-athletes, the athlete main effect represents the difference between the mean of the male athletes and the male non-athletes and the interaction is the difference of two differences - it's the mean athlete/non-athlete difference for females minus the mean athlete/non-athlete difference for makes.

(ii) consider an interaction between gender{m=-1,f=-1} and athlete {n=-1,y=1}

Now the intercept represents the mean of the four group-means (and if the design was completely balanced it would also be the overall mean). The intercept is a quarter of what it was before.

The main effects are averages of difference effects - the gender effect is the average of the female-male difference within atheletes and the female-male difference within non-athletes. The athlete main effect is the average of the athlete/non-athlete difference within females and the athlete/non-athlete difference within males.

Does it depend on whether my cells are of different sizes?

What do you mean by 'different sizes'? Do you mean that the number of observations in each cell are different? (If so, I largely addressed that above - equal cell numbers gives additional meanings/simplifies the interpretation, such as making the intercept the the grand mean of the data rather than just the mean of group means.)

$\endgroup$
  • 1
    $\begingroup$ Very comprehensive answer. I'll add that I see literally no reason to ever code contrasts with a -1, 1 format for levels. Not only does this give effect sizes that don't have direct interpretation (such as "an associated doubled difference in the outcome comparing a unit difference in the predictor"), but it also renders the interpretation of the intercept as a fictitious quantity (rather than the expected outcome for all variables equal to zero). I would advocate always using 0/1 coding for dummy variables. $\endgroup$ – AdamO May 21 '13 at 6:47
  • 1
    $\begingroup$ @AdamO I disagree. 1) If you are concerned that -1,+1 codes don't have a "direct" interpretation, then just use -.5,+.5. 2) As noted by Glen_b, the intercept under such codes represents the mean of the group means; it is entirely unclear how this is any more or less a "fictitious quantity" than are the group means themselves (which may or may not be equal to ANY of the observations in the dataset!). 3) Interactions between dummy-coded factors virtually always render the simple effects void of any interesting/meaningful interpretation; contrast codes offer a far more natural interpretation here $\endgroup$ – Jake Westfall May 21 '13 at 7:26
  • $\begingroup$ Thanks all. Indeed, I was having trouble interpreting the main effects in the presence of an interaction when using dummy coding. I realized that the gender main effect was only for the non-athletes (not any sort of effect of gender averaged over both athletes and non-athletes which is what I get with contrasts). Dan $\endgroup$ – Dan May 21 '13 at 15:18
  • $\begingroup$ "the intercept under such codes represents the mean of the group means": The mean of means is not the marginal mean, which is the only parameter I think we'd care about. Only under balanced design would we come close to having that, and that assumption is too impractical for our purposes. $\endgroup$ – AdamO May 21 '13 at 17:27
  • $\begingroup$ @JakeWestfall As you know the interpretation of the intercept is as an average value in the response when all values of regressors are set to 0. If this value is not likely or worse not even possible, the intercept becomes a fictitious quantity. Even for 0/1 binaries, suppose I indicate two regressors- (0:pregnant, 1:not pregnant) (0:male 1:female) for FEV. The intercept in the model is average FEV in pregnant males. Now if I code, -1:male 1:female, the intercept has absolutely no interpretation at all except for the "average of the average response in males and females". $\endgroup$ – AdamO May 21 '13 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.