# what are contrasts?

#### stablum

##### New Member
Hi,
I am doing homework for an assignment in statistics. I cannot get my mind up for what contrasts are. Anyone can explain that in simple words?

thanks!

#### hlsmith

##### Less is more. Stay pure. Stay poor.
Typically they are the comparisons of two levels or groups in a variable, but we have no idea what type of statistics you are conducting or the course you are taking.

#### stablum

##### New Member
In the specific, I am trying to understand the following piece of R code:
Code:
> pvc$operator=as.factor(pvc$operator)
> pvc$resin=as.factor(pvc$resin)
> pvcaov=lm(psize~operator*resin,data=pvc)
> anova(pvcaov)
[ some output deleted ]
Response: psize
Df Sum Sq Mean Sq F value Pr(>F)
operator           2 20.718 10.359 7.0072 0.00401 **
resin                7 283.946 40.564 27.4388 5.661e-10 ***
operator:resin  14 14.335 1.024 0.6926 0.75987
Residuals        24 35.480 1.478

> contrasts(pvc$operator)=contr.sum > contrasts(pvc$resin)=contr.sum
> pvcaov2=lm(psize~operator*resin,data=pvc)
I don't understand what this does, so I am beginning from the basics, that is, understanding what a contrast actually is and how that concept relates with this piece of code.

#### noetsi

##### No cake for spunky
In general contrast, there are many different types, are determining if the mean of one variable is different from the mean of another variable (although you can compare variables to variables this way as well). Contrast can also be used to determined if the data has a specific form (say a quadratic form) although that is used a lot less.

#### stablum

##### New Member
for what I have understood contrasts are the coefficients of a formula in which the various variables' means are inserted in a polynomial. The result is analyzed with special regard to its sign to understand the "direction" of the factors. Did I get it right?

#### noetsi

##### No cake for spunky
Well contrast have coefficients (which depend on which hypothesis you are testing) and you are applying these to their mean, but I have never heard this expressed in terms of a direction. But more importantly I think you focusing on how a contrast is calculated and what is really important about it is what it is doing. Which is testing if there is a difference between two means.