14
$\begingroup$

If you fit a linear model or a mixed model there are different types of codings available to transform a categorical or nominal varibale into a number of variables for which paramaters are estimated, such as dummy conding (the R default) and effects coding.

I heard that effects coding (sometimes called deviation or contrast coding) is preferred when you have interactions, but what are the possible contrasts and when would you use which type of contrast?

The context is mixed modeling in R using lme4, but I think broader responses are fine. Sorry, if I missed a similar question.

EDIT: Two helpful links are: effect coding & dummy coding explained.

$\endgroup$
  • $\begingroup$ if you have Modern Applied Statistics with S-Plus, it has a great section in Chapter Six on this very question $\endgroup$ – richiemorrisroe May 10 '12 at 12:30
  • 4
    $\begingroup$ I don't think you'll find a complete answer to your question, but there's a lot of good information about different types of codings here. $\endgroup$ – gung May 10 '12 at 13:39
  • $\begingroup$ @gung The site looks really interesting. However it does not seem to cover contrast coding (or is there another name for it). $\endgroup$ – Henrik May 10 '12 at 14:24
  • $\begingroup$ I'm not sure; I wonder if there's a miscommunication. The title of that page is "contrast coding". $\endgroup$ – gung May 10 '12 at 14:31
  • 1
    $\begingroup$ I don't quite understand what question remains. If you wanted a list of different types of codings, you have that. What is the main thrust of your question now? $\endgroup$ – gung May 15 '12 at 17:18
4
$\begingroup$

Others can enlighten me if I am wrong, but here goes…

What is the effect for the level compared to the mean of the previous levels? i.e. you are interested locating the threshold of the effect

  • Use Helmert contrasts. I think of this as cumulative comparisons. I have used this when interested in determining a drugs dose-response limit of the exposure. Comparison to multiple levels at a time means that less information is thrown away. I think of this as cumulative comparisons.

What is the effect of the level relative to a baseline level? i.e. you are interested in one baseline comparison group.

  • Use dummy variable coding (treatment contrasts). I think of this as baseline comparisons. I have used this when there is typically one group/level established as important by other studies, and my study is demonstrating that associations also exist when this threshold is exceeded.

What is the effect of two adjacent levels of a variable?

  • Use forward/backward differencing. I think of this as short-interval successive comparisons. I have used this when comparing effects for different levels of socioeconomic position, when each group is compositionally different in their own right and no more of interest than any other.
$\endgroup$

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.