{{Short description|Concept in statistics}} In statistics, particularly in the analysis of variance and linear regression, a '''contrast''' is a linear combination of variables (parameters or statistics) whose coefficients add up to zero, allowing comparison of different treatments.<ref name="CasellaBerger2001">{{cite book |last=Casella |first=George |author1-link = George Casella |author2-link=Roger Lee Berger |last2=Berger |first2=Roger L |year=2001 |title=Statistical inference |url=http://www.cengage.com/search/productOverview.do?N=16%204294945501%204294965305 |publisher=Cengage Learning |isbn=9780534243128}}</ref><ref name="casella2008">{{cite book |author=George Casella |author-link=George Casella |year=2008 |title=Statistical design |url=https://www.springer.com/statistics/statistical+theory+and+methods/book/978-0-387-75964-7 |publisher=Springer |isbn=978-0-387-75965-4 }}</ref>
==Definitions== Let <math>\theta_1,\ldots,\theta_t</math> be a set of variables, either parameters or statistics, and <math>a_1,\ldots,a_t</math> be known constants. The quantity <math>\sum_{i=1}^t a_i \theta_i</math> is a linear combination. It is called a '''contrast''' if {{nowrap|<math>\sum_{i=1}^t a_i = 0</math>.}}<ref>Casella a Berger 2001, p. 526.</ref><ref name="Casella 2008, p. 11">Casella 2008, p. 11.</ref> Furthermore, two contrasts, <math>\sum_{i=1}^t a_i \theta_i</math> and <math>\sum_{i=1}^t b_i \theta_i</math>, are '''orthogonal''' if {{nowrap|<math>\sum_{i=1}^t a_i b_i = 0</math>.}}<ref>Casella 2008, p. 12.</ref>
==Examples== Let us imagine that we are comparing four means, <math>\mu_1,\mu_2,\mu_3,\mu_4</math>. The following table describes three possible contrasts: {| class="wikitable" style="text-align:center" ! <math>\mu_1</math> !! <math>\mu_2</math> !! <math>\mu_3</math> !! <math>\mu_4</math> |- | 1 || -1 || 0 || 0 |- | 0 || 0 || 1 || -1 |- | 1 || 1 || -1 || -1 |} The first contrast allows comparison of the first mean with the second, the second contrast allows comparison of the third mean with the fourth, and the third contrast allows comparison of the average of the first two means with the average of the last two.<ref name="Casella 2008, p. 11"/>
In a balanced one-way analysis of variance, using orthogonal contrasts has the advantage of completely partitioning the treatment sum of squares into non-overlapping additive components that represent the variation due to each contrast.<ref>Casella 2008, p. 13.</ref> Consider the numbers above: each of the rows sums up to zero (hence they are contrasts). If we multiply each element of the first row by the corresponding element of the second row and add those up, this again results in zero, thus the first and second contrast are orthogonal and so on.
==Sets of contrast== *'''Orthogonal contrasts''' are a set of contrasts in which, for any distinct pair, the sum of the cross-products of the coefficients is zero (assume sample sizes are equal).<ref name=EV>Everitt, B.S. (2002) ''The Cambridge Dictionary of Statistics'', CUP. {{isbn|0-521-81099-X}} (entry for "Orthogonal contrasts")</ref> Although there are potentially infinite sets of orthogonal contrasts, within any given set there will always be a maximum of exactly ''k'' – 1 possible orthogonal contrasts (where ''k'' is the number of group means available).<ref name="Howell"/> *'''Polynomial contrasts''' are a special set of orthogonal contrasts that test polynomial patterns in data with more than two means (e.g., linear, quadratic, cubic, quartic, etc.).<ref>{{cite web |last=Kim |first=Jong Sung |title=Orthogonal Polynomial Contrasts |url=http://www.mth.pdx.edu/~jkim/Teaching/S4566/S2012/Handout/Hd6_1%28Polycnst_RCBD%29.pdf |accessdate=27 April 2012}}</ref> *'''Orthonormal contrasts''' are orthogonal contrasts which satisfy the additional condition that, for each contrast, the sum squares of the coefficients add up to one.<ref name=EV/>
==Background== A contrast is defined as the sum of each group mean multiplied by a coefficient for each group (i.e., a signed number, c<sub>j</sub>).<ref name="Clark">{{cite book |last=Clark |first=James M. |title=Intermediate Data Analysis: Multiple Regression and Analysis of Variance |year=2007 |location=University of Winnipeg }}</ref> In equation form, <math>L = c_1 \bar X_1 + c_2 \bar X_2 + \cdots + c_k \bar X_k \equiv \sum_j c_j \bar X_j</math>, where L is the weighted sum of group means, the c<sub>j</sub> coefficients represent the assigned weights of the means (these must sum to 0 for orthogonal contrasts), and <math>\bar X</math><sub>j</sub> represents the group means.<ref name="Howell">{{cite book |last=Howell |first=David C. |title=Statistical methods for psychology |year=2010 |publisher=Thomson Wadsworth |location=Belmont, CA |isbn=978-0-495-59784-1 |edition=7th}}</ref> Coefficients can be positive or negative, and fractions or whole numbers, depending on the comparison of interest. Linear contrasts are very useful and can be used to test complex hypotheses when used in conjunction with ANOVA or multiple regression. In essence, each contrast defines and tests for a particular pattern of differences among the means.<ref name="Clark" />
Contrasts should be constructed "to answer specific research questions", and do not necessarily have to be orthogonal.<ref name=Kuehl>{{cite book |last=Kuehl |first=Robert O. |title=Design of experiments: statistical principles of research design and analysis |year=2000 |publisher=Duxbury/Thomson Learning |location=Pacific Grove, CA |isbn=0534368344 |edition=2nd}}</ref>
A simple (not necessarily orthogonal) contrast is the difference between two means. A more complex contrast can test differences among several means (ex. with four means, assigning coefficients of –3, –1, +1, and +3), or test the difference between a single mean and the combined mean of several groups (e.g., if you have four means assign coefficients of –3, +1, +1, and +1) or test the difference between the combined mean of several groups and the combined mean of several other groups (i.e., with four means, assign coefficients of –1, –1, +1, and +1).<ref name="Howell" /> The coefficients for the means to be combined (or averaged) must be the same in magnitude and direction, that is, equally weighted. When means are assigned different coefficients (either in magnitude or direction, or both), the contrast is testing for a difference between those means. A ''contrast'' may be any of: the set of coefficients used to specify a comparison; the specific value of the linear combination obtained for a given study or experiment; the random quantity defined by applying the linear combination to treatment effects when these are themselves considered as random variables. In the last context, the term '''contrast variable''' is sometimes used.
Contrasts are sometimes used to compare mixed effects. A common example is the difference between two test scores — one at the beginning of the semester and one at its end. Note that we are not interested in one of these scores by itself, but only in the contrast (in this case — the difference). Since this is a linear combination of independent variables, its variance equals the weighted sum of the summands' variances; in this case both weights are one. This "blending" of two variables into one might be useful in many cases such as ANOVA, regression, or even as descriptive statistics in its own right.
An example of a complex contrast would be comparing 5 standard treatments to a new treatment, hence giving each old treatment mean a weight of 1/5, and the new sixth treatment mean a weight of −1 (using the equation above). If this new linear combination has a mean zero, this will mean that there is no evidence that the old treatments are different from the new treatment on average. If the sum of the new linear combination is positive, there is some evidence (the strength of the evidence is often associated with the p-value computed on that linear combination) that the combined mean of the 5 standard treatments is higher than the new treatment mean. Analogous conclusions obtain when the linear combination is negative.<ref name="Clark" /> However, the sum of the linear combination is not a significance test, see testing significance (below) to learn how to determine if the contrast computed from the sample is significant.
The usual results for linear combinations of independent random variables mean that the variance of a contrast is equal to the weighted sum of the variances.<ref name="nist">[http://www.itl.nist.gov/div898/handbook/prc/section4/prc426.htm NIST/SEMATECH e-Handbook of Statistical Methods]</ref> If two contrasts are orthogonal, estimates created by using such contrasts will be uncorrelated. If orthogonal contrasts are available, it is possible to summarize the results of a statistical analysis in the form of a simple analysis of variance table, in such a way that it contains the results for different test statistics relating to different contrasts, each of which are statistically independent. Linear contrasts can be easily converted into sums of squares. SS<sub>contrast</sub> = <math>\tfrac{n(\sum c_j \bar X_j)^2 }{\sum c_j^2} </math>, with 1 degree of freedom, where ''n'' represents the number of observations per group. If the contrasts are orthogonal, the sum of the SS<sub>contrasts</sub> = SS<sub>treatment</sub>. Testing the significance of a contrast requires the computation of SS<sub>contrast</sub>.<ref name="Howell" />
==Testing significance== SS<sub>contrast</sub> also happens to be a mean square because all contrasts have 1 degree of freedom. Dividing <math>MS_{contrast}</math> by <math>MS_{error}</math> produces an F-statistic with one and <math>df_{error}</math> degrees of freedom, the statistical significance of ''F''<sub>contrast</sub> can be determined by comparing the obtained F statistic with a critical value of ''F'' with the same degrees of freedom.<ref name="Howell" />
==References== * {{cite book |last=Casella |first=George |last2=Berger |first2=Roger L |year=2001 |title=Statistical inference |url=http://www.cengage.com/search/productOverview.do?N=16%204294945501%204294965305 |publisher=Cengage Learning |isbn=9780534243128}} * {{cite book |author=George Casella |author-link=George Casella |year=2008 |title=Statistical design |url=https://www.springer.com/statistics/statistical+theory+and+methods/book/978-0-387-75964-7 |publisher=Springer |isbn=978-0-387-75965-4}} * {{cite book |last=Everitt |first=B S |last2=Skrondal |first2=A |year=2010 |title=Cambridge dictionary of statistics |edition=4th |url=http://www.cambridge.org/us/academic/subjects/statistics-probability/statistics-and-probability-general-interest/cambridge-dictionary-statistics-4th-edition |publisher=Cambridge University Press |isbn=9780521766999}} * {{cite book |last=Dean |first=Angela M. | author1-link= Angela Dean |last2=Voss |first2=Daniel |year=1999 |title=Design and analysis of experiments |url=https://www.springer.com/mathematics/probability/book/978-0-387-98561-9 |publisher=Springer |isbn=9780387985619}}
==External links== * [https://www.soton.ac.uk/~cpd/anovas/datasets/Orthogonal%20contrasts.htm Examples of orthogonal contrasts for analysis of variance] * [http://www.utdallas.edu/~herve/abdi-contrasts2010-pretty.pdf Contrast Analysis (Abdi & Williams, 2010)]
==Notes== {{Reflist}}
Category:Analysis of variance Category:Regression analysis Category:Multiple comparisons