(SPSS v 8.0)
Reading: SPSS Base 8.0 User's Guide, Chapter 18, One-Way
Analysis of Variance
Homework: Oneway
Download: oneway.sav (Download Tips)
![]()
Single-factor experiments have one independent variable. SPSS has several different procedures which will analyze single- factor experiments: oneway, general linear model, and means.
This set of notes will focus on the oneway procedure.
Oneway can providing you with:
(a) a test of the homogeneity of cell variances,
(b) a test of trend,
(c) multiple comparison (post-hoc) tests between the means,
(d) planned (a priori) comparisons between means, and
(e) it can give appropriate tests for unequal ns.
What doesn't it do?
(a) It does not test the assumption of normal distributions within each cell of the oneway
design. You still need to run explore to test the normality assumption.
(b) Oneway will not handle repeated measures designs.
(c) Oneway does not provide you alternative ways of handing data when the distribution
assumptions have not been met.
The data for this set of notes come from a study by Friedman, Harper, Becker, Wilson, and Tinker (1997). They hypothesized (a) that children who have experienced psychological trauma will display symptoms that are similar to children who suffer from attention-deficit/hyperactivity disorder (ADHD) and (b) that the ADHD and trauma group scores would be higher than those of the control group. Three groups of children and their parents were recruited from the community. One group was recruited to participate in a posttraumatic stress disorder (PTSD) treatment outcome study (n = 16). A second group was recruited to participate in a study of children who suffer from ADHD (n = 14). The third group, the control group, suffered from neither PTSD or ADHD (n = 22). Friedman et al. looked at the hyperactivity and attention scales of the Behavior Assessment System for Children (BASC) - Parent Rating Form (Reynolds & Kamphaus, 1992). The hyperactivity scores are reported as T scores. T scores have a mean of 50 and a standard deviation of 10. As the name implies, the ratings of hyperactivity and attention were made by the parent of the child. We will be looking at the results of the BASC hyperactivity scale for this set of notes. The variables in the data file, oneway.sav, are shown in Table 1.
| Variable | Variable Label / Value Labels / Missing Values |
|---|---|
| id | |
| group | Group / 1 Control 2 ADHD 3 trauma |
| hyperact | BASC Hyperactivity T score |
The assumptions for a oneway analysis of variance are shown in Table 2.
| 1. Are the observations in each of the groups independent ? 2. What is the scale of measurement for the dependent variable? 3. What are the shapes of the distributions in each of the groups? 4. Are the distributions in each of the groups homogeneous? |
Assumption 1 (independence). The data must be independent, oneway does not handle repeated measures designs. In this example the three groups are made up of separate individuals so the data are independent.
Assumption 2 (scale of measurement). The scale of measurement for the BASC hyperactivity scale is interval.
Assumption 3 (normality). It is assumed that the distributions in each of the groups are normal. The analysis of variance is robust if each of the distributions are symmetric or if all the distributions are skewed in the same direction. This assumption can be tested by running several normality tests. The skewness statistics are shown in Table 3.
| Independent variable group | Statistic | Std. Error | ||
|---|---|---|---|---|
| BASC hyperactivity T score | control | Mean | 43.82 | 2.20 |
| Skewness | .973 | .491 | ||
| Kurtosis | .341 | .953 | ||
| ADHD | Mean | 60.14 | 2.71 | |
| Skewness | -.235 | .597 | ||
| Kurtosis | -1.066 | 1.154 | ||
| trauma | Mean | 64.75 | 3.61 | |
| Skewness | -.407 | .564 | ||
| Kurtosis | -1.289 | 1.091 | ||
The skewness and kurtosis scores indicate that the scores in the ADHD and trauma conditions are normally distributed. There is some positive skewness in the control condition. The normality statistics are shown in Table 4.
| Kolmogorov-Smirnov(a) | Shapiro-Wilk | ||||||
|---|---|---|---|---|---|---|---|
| Independent variable group | Statistic | df | Sig. | Statistic | df | Sig. | |
| BASC hyperactivity T score | control | .206 | 22 | .016 | .912 | 22 | .055 |
| ADHD | .166 | 14 | .200(*) | .940 | 14 | .442 | |
| trauma | .151 | 16 | .200(*) | .900 | 16 | .084 | |
| * This is a lower bound of the true significance. | |||||||
| a Lilliefors Significance Correction | |||||||
The Shapiro-Wilk normality tests indicate that the scores are normally distributed in each of the three conditions. The Kolmogorov-Statistic is significant, but that statistic is more appropriate for larger sample sizes.
4. Assumption 4 (homogeneity). Boxplots, as provided by the explore procedure, give a graphic representation of homogeneity. The boxplots are presented in Figure 1.
Figure 1. Boxplots for the control, ADHD, and trauma groups.
Visual inspection of the box lengths indicates that the trauma group has greater variability than the control group, we will want to check the Levene statistics to see if there is are significant differences in variability between the three groups. You can ask for the Levene test either in explore or in the oneway procedure. Lets see what it looks like when we ask for the Levene test from oneway.
The medians suggest that the analysis of variance will support the hypotheses.
The oneway procedure is selected by clicking
Statistics
Compare Means
One-Way ANOVA...
The variables in the Data Editor are shown in the box at the left. Move hyperact to the Dependent List: box and group to the Factor: box. Factor: is the independent variable.
Click on the Options... button. Then select Descriptive to display descriptive statistics and Homogeneity-of-variance to display Levene's test.
The missing values options are not relevant in this example because we are running only one analysis of variance. You could exclude cases either on an analysis by analysis basis or listwise. If listwise is selected then if any of the independent or dependent values are missing the entire case is deleted from all the analysis.
Check Means plot to see the graphics produced by the one-way procedure.
Post Hoc... provides a list of post-hoc tests and Contrasts... will allow you to compare means by defining your own set of contrasts. We will look at those options later in this set of notes.
Contrasts... allows you to specify a particular contrast (e.g., polynomial contrast) or to specify apriori contrasts. We will look at contrasts later in this set of notes.
Click the OK button to run the oneway analysis of variance.
The output from the oneway includes Levene's test of homogeneity of variance (shown in Table 5), descriptive statistics (shown in Table 6), the oneway anova statistics (shown in Table 7), and a plot of the three means (shown in Figure 2).
The variances are homogeneous, Levene(2, 49) = 2.28, p = .113, see Table 5.
Table 5. Test of Homogeneity of Variances
Levene Statistic |
df1 |
df2 |
Sig. |
2.284 |
2 |
49 |
.113 |
The descriptive statistics are displayed for each cell and for the combined scores, see Table 6. Descriptive statistics include the number of cases, n, the mean, standard deviation, standard error of the mean, the 95% confidence interval and the minimum and maximum scores.
The standard error is found by dividing the standard deviation by the square root of the number of cases in the cell.
The 95% Confidence Intervals around each mean are found as
Mean ± t.05 (df) x Std. Error
where t is the value found in the table of values for the t distribution, and df is the number of cases in the cell -1. For example, for the control cell -
Mean ± t.05 (df) x Std. Error
43.82 ± t.05 (21) x 2.20
43.82 ± 2.080 x 2.20
43.82 ± 4.576
| N | Mean | Std. Deviation | Std. Error | 95% Confidence Interval for Mean | Minimum | Maximum | ||||
|---|---|---|---|---|---|---|---|---|---|---|
| Lower Bound | Upper Bound |
|||||||||
| BASC hyperactivity T score | Group | control | 22 | 43.82 | 10.32 | 2.20 | 39.24 | 48.39 | 29 | 69 |
| ADHD | 14 | 60.14 | 10.13 | 2.71 | 54.29 | 65.99 | 42 | 74 | ||
| trauma | 16 | 64.75 | 14.45 | 3.61 | 57.05 | 72.45 | 42 | 82 | ||
| Total | 52 | 54.65 | 14.91 | 2.07 | 50.50 | 58.81 | 29 | 82 | ||
The analysis of variance is significant, F (2, 49) = 16.94, p < .0005, indicating that the means for the three groups in this study are not equal. The question now becomes which of those means are significantly different from each other. Inspection of the 95% confidence intervals in Table 6 suggests that the means for the ADHD and trauma groups are not significantly different from each other and that the mean for control group is smaller than either of the other two groups.
| Sum of Squares | df | Mean Square | F | Sig. | ||
|---|---|---|---|---|---|---|
| BASC hyperactivity T score | Between Groups | 4635.782 | 2 | 2317.891 | 16.942 | .000 |
| Within Groups | 6703.987 | 49 | 136.816 | |||
| Total | 11339.769 | 51 | ||||
There are two more formal ways of comparing mean differences. You could run a post-hoc test or you could define a set of contrasts to tests particular hypotheses about the mean differences.
Mean Plots
The mean plots are shown in Figure 2.

Figure 2. Mean BASC hyperactivity T scores for the participants diagnosed as ADHD, PTSD, and a control group without either diagnosis.
The mean plots displayed by the one-way ANOVA procedure are difficult to interpret because
they do not include error bars. A more informative presentation can be made using
the Graph option.
Graphs
Interactive
Error Bar
Move the BASC T score to the y-axis and the Group variable to the x-axis. At the bottom of the window select Confidence Interval for the Mean in the Error Bars Represent box. Next, go to the error bar folder and select the shape and direction of the desired error bars.
The graph is shown in Figure 3. The confidence intervals help to show that the means for the ADHD and Trauma groups are not significantly different from each other because the 95% C. I. of one mean includes the other mean. The control group is significantly smaller than the mean of the other two groups because the 95 % C. I. for the control group does include the means of either the ADHD group or the trauma group.

Figure 3. Mean BASC hyperactivity T scores and 95% confidence intervals for the participants diagnosed as ADHD, PTSD, and a control group without either diagnosis.
The oneway procedure provides a wide array of possibilities for running post hoc tests. Click on Post Hoc... to view those options. The options are divided into two main groupings. The grouping at the top of the dialog box, Equal Variances Assumed, includes 14 tests that are appropriate when the variances are homogeneous. The grouping in the middle of the dialog box, Equal Variances Not Assumed, includes 4 tests that are appropriate when the variances are not homogeneous. You can set the significance level by entering the level in the Significance level: window at the bottom of the dialog box.
The post hoc tests available on oneway in SPSS 8.0 (and 7.5) are shown in Table 8. Range test are used to identify subsets of means that do not differ from each other. Pairwise tests compare the differences between each pair of means.
| Test | Name of Test / Comments | Range Test |
Pairwise Test |
|---|---|---|---|
| Equal Variances Assumed | |||
| LSD | Least Significant Difference / Equivalent to running simple t tests for each pair of means. The alpha level is not controlled. |
Yes | |
| Bonferroni | Assumes that you wish to test all possible pairs of means. The actual
alpha level is the significance level defined in the dialog box divided by the number of
possible pairs of means (called C, the number of comparisons). corrected alpha = alpha/C For example, if there are three means then there are three possible pairs of means (1 v 2, 1 v 3, and 2 v 3). If the significance level in the dialog box is set at .05, then the Bonferroni corrected alpha level is corrected alpha = .05/3 = .01667 |
Yes | |
| Sidak | Assumes that you wish to test all possible pairs of means. The Sidak
formula is: corrected alpha = 1 - (1 - alpha)1/C where C is the number of comparisons. For example, if there are three means then there are three possible pairs of means (1 v 2, 1 v 3, and 2 v 3). If the significance level in the dialog box is set at .05, then the Sidak corrected alpha level is corrected alpha = 1 - (1 - .05)1/3 The Sidak procedure has slightly more power than the Bonferroni procedure when alpha = .05. When alpha = .01 the two procedures are nearly identical. |
Yes | |
| Scheffe | Assumes you wish to test all possible pairs and all possible combinations
of means. Note that this is a very conservative test. For example, if you have three
means, then there are six possible comparisons (1 v 2, 1 v 3, 2 v 3, 1+2 v 3, 1+3 v 2, and
2+3 v 1). Do not use the Scheffe method if you do not intend to test all possible pairs and
all possible combinations of means. For three means and an original alpha of .05, the corrected alpha level would be corrected alpha = .05/6 = .0083 Scheffe is exact for unequal group sizes. |
Yes | |
| R-E-G-W F | Ryan-Einot-Gabriel-Welsch F | Yes | |
| R-E-G-W Q | Ryan-Einot-Gabriel-Welsch range test | Yes | |
| S-N-K | Student-Newman-Keuls. This is a stepwise test for ordered means where the alpha level depends upon the number of "steps apart" each of the means are from each other. S-N-K is not exact if group sizes are not equal. | Yes | |
| Tukey | Honest Significant Difference (HSD). Tukey is not exact if group sizes are not equal. | Yes | Yes |
| Tukey's-b | Tukey's alternative procedure. This is a stepwise test for ordered means there the alpha (see S-N-K). It uses the average of the Tukey and the S-N-K procedure at each step. It is not exact if group sizes are not equal. | Yes | |
| Duncan | Multiple Range Test. This is a stepwise test for ordered means (see S-N-K). Duncan's test is not exact if the group sizes are not equal. | Yes | |
| Hochberg's GT2 | Yes | Yes | |
| Gabriel | Yes | Yes | |
| Waller-Duncan | Yes | ||
| Dunnett | Tests a control mean against all other means. | Yes | |
| Equal Variances Not Assumed | |||
| Tamhane's T2 | Uses the Welch procedure for determining degrees of freedom for the SE of the contrast. Uses Student's t distribution. Uses the Sidak procedure to find the alpha level. Slightly more conservative that the Games-Howell procedure. Appropriate when variances are unequal or when variances and group sizes are unequal. | Yes | |
| Dunnett's T3 | Yes | ||
| Games-Howell | Uses the Welch procedure for determining degrees of freedom for the SE of the contrast. Uses the studentized range distribution. Appropriate when variances are unequal or when variances and group sizes are unequal. | Yes | |
| Dunnett's C | Yes | ||
Most graduate level statistics spend several pages discussing alternative post-hoc tests. It is up to you to to understand the post hoc test that you have chosen to use. You should not pick a test at random, nor pick the one based on the results of the tests.
As a general rule, if you want to make all possible pairwise comparisons between means then many statistics books recommend either the Tukey HSD test or the Fisher protected least significance difference test, which is also known as the Bonferroni corrected test, or the Dunn procedure.
Let's look at the Tukey HSD post hoc test. The HSD is both a range test and a pairwise test. The output from the HSD pairwise test is shown in Table 9, the output from the HSD range test is shown in Table 10.
| Mean Difference (I-J) | Std. Error | Sig. | 95% Confidence Interval | |||
|---|---|---|---|---|---|---|
| (I) Group | (J) Group |
Lower Bound | Upper Bound | |||
| control | ADHD | -16.32(*) | 3.999 | .000 | -25.99 | -6.66 |
| trauma | -20.93(*) | 3.843 | .000 | -30.22 | -11.64 | |
| ADHD | control | 16.32(*) | 3.999 | .000 | 6.66 | 25.99 |
| trauma | -4.61 | 4.281 | .533 | -14.95 | 5.74 | |
| trauma | control | 20.93(*) | 3.843 | .000 | 11.64 | 30.22 |
| ADHD | 4.61 | 4.281 | .533 | -5.74 | 14.95 | |
| * The mean difference is significant at the .05 level. | ||||||
In Table 9 the mean of each group is compared to the mean of each of the other groups. For example the mean of the control group is compared to the mean of the ADHD group and to the mean of the trauma group. This makes for some redundancy in the table. For example the comparison between the control group and the ADHD group is the same as the comparison between the ADHD and the control group
Lets look at the first row in Table 9. The mean of the control group (Group I) is 43.82. The mean of the ADHD group (Group J) is 60.14. The mean difference (I - J) is -16.32(*). The asterisk indicates that the mean difference is significant at the .0167 level (see the asterisk note at the bottom of the table). The standard error of the difference is found using the formula

where MSerror is the within cells error term from the analysis of variance, ni is the number of cases in group i, and nj is the number of cases in group j. For the control vs. ADHD comparison
![]()
![]()
= 3.999
| N | Subset for alpha = .05 | ||
|---|---|---|---|
| Group |
1 | 2 | |
| control | 22 | 43.82 | |
| ADHD | 14 | 60.14 | |
| trauma | 16 | 64.75 | |
| Sig. | 1.000 | .495 | |
| Means for groups in homogeneous subsets are displayed. | |||
| a Uses Harmonic Mean Sample Size = 16.724 | |||
| b The group sizes are unequal. The harmonic mean of the group sizes is used. Type I error levels are not guaranteed. | |||
The range tests in Table 10 identify subsets of means that do not differ from each other. There are two subsets for the hyperactivity scores. Subset 1 contains only the mean for the control group. The control group mean is significantly different from the other two means because the other two means are a part of subset 1. Subset 2 contains the means for the ADHD and the trauma groups indicating that those two means are not significantly different from each other.
In this unequal n study the confidence intervals for the paired comparisons were different for each comparison because the standard error was a function of the differing cell ns. In order to compute homogeneous subsets you need to have a common confidence interval for each of the comparisons. The harmonic mean is used as the number of cases in each group rather than the group ns. The harmonic mean sample size is found by the following formula
Nh = p / (1/N(1) + 1/N(2) + ... + 1/N(p))
where p is the number of cells in the ONEWAY analysis.
The harmonic mean of the ns for all cells in this analysis would be
Nh = 3/(1/22 + 1/14 + 1/16) = 16.724
If you make a specific hypothesis about the expected pattern of means prior actually running the hypothesis, then you can make a "planned comparisons" test of the hypothesis. Planned comparisons typically test only a subset of all possible comparisons.
Recall that the hypotheses for this study were: (a) that children who have experienced psychological trauma will display symptoms that are similar to children who suffer from attention-deficit/hyperactivity disorder (ADHD) and (b) that the ADHD and trauma group scores would be higher than those of the control group.
The first hypothesis is that the ADHD and trauma groups do not differ from each other. We can translate this statement into an equation of the form
y = (c1)(M1) + (c2)(M2) + (c3)(M3) = 0
where c1, c2, and c3 are coefficients and M1, M2, and M3 are the means for the each of the three groups. The entire set of coefficients and means is called a contrast.
The coefficients for the first hypothesis are
y 1 = (0)(M1) + (1)(M2) + (-1)(M3) = 0
This contrasts says that if the mean of group 3 is subtracted from the mean of group 2 then the difference will be zero. This is the same as saying that the null hypothesis is that the mean of group 2 does not differ from the mean of group 3. If group 2 is greater than group 3, then the contrast will be positive, if group 2 is smaller than group 3 then the contrast will be negative. So the question is, "Is the value of the contrast significantly different from zero?"
Multiplying the mean of group 1 by zero effectively removes group 1 from consideration, its value is always zero in this contrast.
The contrast for the second hypothesis is
y 2 = (1)(M1) + (M2 + M3)/2
y 2 = (1)(M1) + (-.5)(M2) + (-.5)(M3)
It states that the mean of the control group is not different from the average of the other two groups. If the mean of the other two groups is larger than the control mean, then the contrast will be negative. If the mean of the other two groups is smaller than the control mean, then the contrast will be positive.
The rules for writing contrasts are given in Table 11.
| (1) When we write a contrast for a factor we need to specify the
coefficients for all the levels of that factor. (2) We need to have at least two coefficients which are non zero. (3) The sum of the coefficients must be zero. |
Another interesting aspect of contrasts is that if we multiply the coefficients by a constant the resulting contrast will produce the same outcome. That is if we take
y 2 = (1)(M1) + (-1/2)(M2) + (-1/2)(M3)
and multiply the coefficients by 2, the resulting contrast
y 2a = (2)(M1) + (-1)(M2) + (-1)(M3)
is conceptually identical to the first. We are still comparing the mean of the control group with the combined mean of the other two drug groups.
Open the Contrasts... dialog box. Enter the coefficients for the first contrast,
y 1 = (0)(M1) + (1)(M2) + (-1)(M3) = 0
by entering 0 in the Coefficients: window and then Add it to the coefficient list. Do the same for the coefficient for groups 2 and 3. When you have added all three coefficients the the Coefficient Total at the bottom of the dialog box should be 0.000.
Press Next to enter the next contrast,
y 2a = (2)(M1) + (-1)(M2) + (-1)(M3).
Enter the three coefficients, 2, -1, and -1. The Coefficient Total should be 0.000. Press Continue and then OK to run the oneway anova.
The output will include an analysis of variance table. It should be exactly the same as the table produced by our earlier analysis. The contrast coefficients are then displayed, see Table 12. Check the contrasts to make sure they are what you intended them to be.
| Group | |||
|---|---|---|---|
| Contrast | control | ADHD | trauma |
| 1 | 0 | 1 | -1 |
| 2 | 2 | -1 | -1 |
The tests of each of the contrasts are then displayed, see Table 13.
| Contrast | Value of Contrast | Std. Error | t | df | Sig. (2-tailed) | ||
|---|---|---|---|---|---|---|---|
| BASC hyperactivity T score | Assume equal variances | 1 | -4.61 | 4.28 | -1.076 | 49 | .287 |
| 2 | -37.26 | 6.57 | -5.668 | 49 | .000 | ||
| Does not assume equal variances | 1 | -4.61 | 4.51 | -1.020 | 26.817 | .317 | |
| 2 | -37.26 | 6.30 | -5.909 | 47.372 | .000 | ||
The t value is found by dividing the value of the contrast by the standard error.
The value of the contrast is found by multiplying the means by their respective coefficients. The value of the contrast 1 is
y 1 = (0)(M1) + (1)(M2)
+ (-1)(M3)
= (0)(43.82) + (1)(60.14) +
(-1)(64.75)
= 0 + 60.14 - 64.75
= -4.61
The value of the contrast 2a is
y 2a = (2)(M1) + (-1)(M2) +
(-1)(M3)
= (2)(43.82) +
(-1)(60.14) + (-1)(64.75)
= 87.64 - 60.14 - 64.75
= -37.25
There are two sets of tests, one set assumes that the variances are equal, the other does not assume the variances are equal. We have tested the equality of variances earlier and found them to be homogeneous so we would select the statistics in the Assume equal variances row.
The pooled standard error (equal variance assumed) is found as

where MSe is the mean square error from the analysis of variance, cj are the coefficients for each mean, and nj are the ns for each mean.
For the first contrast the pooled standard error is

![]()
The first contrast (0 1 -1) is not significant. There is no difference between the ADHD (M = 60.14, SD = 10.13) and trauma (M = 64.75, SD = 14.45) groups on the BASC hyperactivity score, t(49) = -1.08, p = .287. The first hypothesis was supported.
The second contrast (2 -1 -1) is significant. The control group (M = 43.82, SD = 10.32) is lower than the mean of the other two groups (M = 57.40), t(49) = 5.67, p < .005.
Friedman, M. C., Harper, M. L., Becker, L. A., Wilson, S. A., & Tinker, R. H. (1997, November). A comparison of attention deficit/hyperactivity disorder and posttraumatic stress disorder symptomatology in children. Poster presented at the annual meeting of the International Society for Traumatic Stress Studies. November, 1997. Montreal, Canada.
©Lee A. Becker, 1997, 1998 - revised 11/03/99