Under what cases do you create contrasts in your analysis? How is it done and what is it used for?
I checked ?contrasts
and ?C
- both lead to "Chapter 2 of Statistical Models in S", which is not readily available to me.
Contrasts are needed when you fit linear models with factors (i.e. categorical variables) as explanatory variables. The contrast specifies how the levels of the factors will be coded into a family of numeric dummy variables for fitting the model.
Here are some good notes for the different varieties of contrasts used: http://www.unc.edu/courses/2006spring/ecol/145/001/docs/lectures/lecture26.htm
When the contrasts used are changed, the model remains the same in terms of the underlying joint probability distributions allowed. Only its parametrization changes. The fitted values remain the same as well. Also, once you have the value of the parameters for one choice of contrasts, it is easy to derive what the value of the parameters for another choice of contrasts would have been.
Therefore the choice of contrasts has no statistical consequence. It is purely a matter of making coefficients and hypothesis tests easier to interpret.