FAQ/polybs - CBU statistics Wiki
location: FAQ / polybs

How do I test for a trend, or perform a contrast, between group means in a one-way ANOVA representing different subjects and check for locations of asymptotes on a curve?

Let us suppose we wish to test for a linear trend between between subjects group means. This can be done using polynomial coefficients


In the case of unequal group sizes SPSS produces two outputs in an ANOVA called weighted and unweighted sums of squares. The weighted sums of squares assumes group sizes are important for example to reflect relative sizes of each group in the general population. Unweighted sums of squares ignore differences in group sizes and compares group means using the same average group size for each group so each group contributes equally to the trend analysis. The unweighted results may also be obtained running a trend test using contrast coefficients as below.

  correct BY priming
  /CONTRAST= 1 0 -1

Using the contrast coefficient for testing a linear trend over three groups, (1, 0 -1), gives the equivalent unweighted result corresponding to a t-test on N-k degrees of freedom of the contrast by dividing (mean1 - mean3) by its standard error. The standard error of the contrast is given by Sqrt(MSE sum_over i[c(i)2 ]/n(i) ) where c(i) is the contrast coefficient for the i-th group mean with i-th group sample size of n(i) for each of k groups and a total sample size (summing all the group sizes) of N. MSE is the mean square error term from the usual one-way between subjects ANOVA. Howell (1997) gives a table of contrast coefficients for testing trend and also illustrates their computation in the case where the groups represent time periods with unequal intervals.

The unweighted sums of squares for contrast and error in the ANOVA using /POLYNOMIAL=1 as a subcommand may be obtained from the t-test outputted using the contrast coefficients as a subcommand by squaring the values of the contrast and standard error terms respectively and dividing by c(i)2 /n(i). This description is a generalization of the formula given in Boniface (1995) who deals with the case of equal group sizes.

To illustrate the use of unweighted means suppose we have three group means of respectively 2.00, 3.75 and 5.75 with respective group sizes 3, 4 and 4 and we wish to see if there is a linear trend. A one-way ANOVA with group gives a mean square error of 3.68. In the above example the unweighted t-test for linear trend on (11-3) df = (5.75-2.00) / sqrt(MSE (1/3 + 1/4) ) = 3.75/sqrt(3.68 [0.583]) = 3.75/1.46 giving a t(8) = 2.56.

The unweighted ANOVA using the polynomial=1 subcommand gives the ANOVA equivalent of the t-test for unweighted results. The sums of squares (SS) in the outputted ANOVA are obtained by squaring the numerator and denominator in the t-test and dividing by (1/3+1/4) = 0.583 giving a weighted SS(linear contrast) = 3.75^2/0.583 = 24.1 and SS(error term) = MSE =3.68. The F ratio = 24.1/3.68 = 6.56 which is simply the square of the t-ratio with an identical p-value.

The weighted output from the one-way ANOVA in SPSS using the /polynomial=1 subcommand corresponds to using an average mean of group sizes equal to the harmonic mean. Weighted and unweighted results are equivalent if all the groups have the same sample size.

For further discussion on the differences between weighted and unweighted analyses see the first half of Amy Shelton's excellent on-line tutorial given in a pdf file which can be accessed from here.

Note that linear and higher order trend tests are performed by SPSS in repeated measures ANOVA by default using the GLM procedure (see Post-hoc Grad talk for further details here). Trend tests may be carried out without a significant overall F as it looks at a specific relationship between group means which is not tested by the overall F test in the ANOVA. Trend tests are usually planned (apriori) comparisons. A further explanation about the difference between a group trend and an overall group comparison is given here.


Boniface DR (1995) Experiment design and statistical methods for behavioural and social research. Chapman and Hall:London. This book is available in the CBU library.

Howell DC (1997) Statistical Methods for psychology. Fourth edition. Duxbury press:Belmont,CA.

None: FAQ/polybs (last edited 2015-02-02 12:54:57 by PeterWatson)