Stat Quiz
Analysis of Variance
(ANOVA)
When and Why
- When we want to compare means we can use a t-test. This test has limitations:
You can compare only 2 means: often we would like to compare means from 3 or more groups.
- An ANOVA is a way to compare multiple sample means to see if they are significantly different.
The Basic ANOVA Situation
- Two variables: 1 Categorical, 1 Quantitative
- Main Question: Do the (means of) the quantitative variables depend on which group (given by categorical variable) the individual is in?
- The procedure works by analyzing the sample variance
- The term comes from a term that describes what the test does:
ANalysis Of VAriance = ANOVA.
What Does ANOVA Tell us?
- It tells us that overall the group means are different.
- Compare several means simultaneously.
- It does NOT tell us exactly which means differ.
The Logic of the Analysis of Variance Technique:
In order to compare the means of the levels of the test factor, a measure of the variation between the levels is compared to a measure of the variation within the levels. This measure is called the F value.
If the variation between the levels is significantly larger than the variation within the levels, then the means for each of the factor levels are not all the same. This implies the factor being tested has a significant effect on the response variable.
- If the variation between the levels is not significantly larger than the variation within the levels, we cannot reject the null hypothesis that all means are equal.
F - distribution
FTR
*
Assumptions of ANOVA
- The populations from which the samples were obtained must be normally or approximately normally distributed
- The variances of the populations must be equal or approximately equal
- the samples are independent of each other
Note: If assumptions are not fulfilled, use Kruskal–Wallis
| Finding the F test Value for the Analysis of Variance | |
| Step 1 | Find the mean and variance (or standard deviation ) of each sample |
| Step 2 | Find the grand mean |
| Step 3 | Find the between-group variance |
| Step 4 | Find the within-group variance |
| Step 5 | Find the F test value |
| Step 6 | Find the F test (Critical value) from the table using: d.f. numerator = K-1 d.f. denominator= N- K |
| Step 7 | Compare the two F values |
K = number of groups and N= sum of the sample sizes for the groups
| Analysis of Variance Summary Table | |||||
| Source | Sum of Squares | Degrees of freedom (df) | Mean of Square | F | P-value |
| Between Groups | K-1 | ||||
| Within Groups | N - K | ||||
| Total |
A researcher wishes to investigate the effect of two different drugs on resting pulse when compared to a placebo. Twenty-three subjects are randomized into three groups of eight.
H0: µ1 = µ 2 = µ placebo
H1: At least one mean is different
Example
| Treatment Group | Drug 1 | 60 | 64 | 65 | 55 | 56 | 58 | 61 | 63 |
| Placebo | 74 | 77 | 74 | 78 | 72 | 69 | 68 | ||
| Drug 2 | 75 | 73 | 70 | 67 | 66 | 72 | 69 | 70 |
*
- Between groups sum of the squares = 8(60.25 – 67.65)2 + 7(73.14 – 67.65)2 + 8(70.25 – 67.65)2 = 703.36
- Between groups degrees of freedom = d.f. = K-1= 3-1 = 2
- Thus 703/2 = 351.68 is a measure of the variation between the groups. It is called the explained variation
| Treatment Group | Total | |||
| Drug 1 | Placebo | Drug 2 | ||
| 60 | 74 | 75 | ||
| 64 | 77 | 73 | ||
| 65 | 74 | 70 | ||
| 55 | 78 | 67 | ||
| 56 | 72 | 66 | ||
| 58 | 69 | 72 | ||
| 61 | 68 | 69 | ||
| 63 | 70 | |||
| SUM | 482 | 512 | 562 | 1556 |
| n | 8 | 7 | 8 | 23 |
| Mean | 60.25 | 73.14 | 70.25 | 67.65 |
| Standard deviation (s) | 3.69 | 3.76 | 3.01 |
- Within groups sum of squares = 7(3.69)2 + 6(3.76)2 + 7(3.01)2= 243.86
- Within groups degrees of freedom = d.f = N - K =23 -3=20
- Thus 243.86/20 = 12.19 is a measure of the variation within the groups. It is called the unexplained variation
| Treatment Group | Total | |||
| Drug 1 | Placebo | Drug 2 | ||
| 60 | 74 | 75 | ||
| 64 | 77 | 73 | ||
| 65 | 74 | 70 | ||
| 55 | 78 | 67 | ||
| 56 | 72 | 66 | ||
| 58 | 69 | 72 | ||
| 61 | 68 | 69 | ||
| 63 | 70 | |||
| SUM | 482 | 512 | 562 | 1556 |
| n | 8 | 7 | 8 | 23 |
| Mean | 60.25 | 73.14 | 70.25 | 67.65 |
| Standard deviation (s) | 3.69 | 3.76 | 3.01 |
Test Statistic Method
- Fs = 28.84 and Fcritical (from Table)= F2,20= 3.49
- Since the test statistic, 28.84, is greater than the critical value, 3.49, we reject the null hypothesis.
- Thus we conclude that not all means are the same
Note: We do not know which of the means demonstrate significant differences.
Confidence Interval Method
57.16
63.34
Group 1
67.73
72.77
Group 2
69.66
76.62
Placebo
*
SPSS output
SPSS output
1
B
B
K
SS
MS
=
-
W
W
NK
SS
MS
=
-
____
GM
X
N
X
å
=
B
W
F
MS
MS
=
B
SS
w
SS
2
____
()
B
iGM
i
SS
nXX
=
å-
2
(1)
Wi
i
n
SSS
=å-
____
1556
23
GM
X
N
X
å
=
=
variance
351.68
28.84
12.19
variance
Betweengroup
F
Withingroup
-
===
-