For a fuller treatment on what one-way ANOVA is, see our One-Way ANOVA tutorial here. This tutorial will go over how to conduct one-way ANOVA using SAS.
The data we are using can be downloaded here.
We want to study the effectiveness of different treatments on anxiety. We collect a sample of 75 subjects in the following categories:
- No treatment (\(n_1\) = 27).
- Biofeedback (\(n_2\) = 24).
- Cognitive-behavioral Treatment (\(n_3\) = 24).
The dependent variable is anxiety levels. The null hypothesis is that all three means are equal.
- \(H_0\) : \(\mu_1 = \mu_2 = \mu_3\)
- \(H_A\) : At least two \(\mu_i\)’s are different
If even two of the means are significantly different, we reject the null hypothesis.
One-Way ANOVA in SAS
We can visualize the data with bar graphs to check for normality and equality of variances across groups. SAS will print this automatically when we run our ANOVA.
We can conduct our ANOVA and view the results below:
proc anova data=anova; class treatment; model anxiety = treatment; means treatment / tukey; run;
class statement tells SAS that treatment is a categorical variable. The
means statement will provide all pairwise comparisons, with p-values adjusted using Tukey’s method.
This will give us the following figure:
Normality looks good. The equality of variances assumption appears suspect (this can be tested). We will also get the following output:
The first two tables give the class level variable (treatment) and its possible levels (1, 2 or 3), and the number of observations used (\(n=75\)).
The next three tables give the results of the ANOVA. We find the \(F\) statistic to be 8.75, which we compare to an \(F\) distribution with \(df_1\) = 2 and \(df_2\) = 72. The cut-off for significance given these \(df\) is 3.124, so we have a significant result (\(p<.001\)). We can reject the null hypothesis that all \(\mu_i\)’s are equal.
Although we see that some of the means are different, the \(F\)-test doesn’t tell us which means are different. We therefore carry out post hoc contrasts consisting of all pairwise comparisons. The last table give us the results based on the Tukey-adjusted p-values. We find that group 1 and group 3 are significantly differently.