ANALYSIS OF
VARIANCE (ANOVA)
ONE-WAY ANOVA
A method of statistical inference used to determine if the
means from more than two populations are different
PRODUCT COMPARISONS
• Say there are comparisons being done on the content (in milligrams) of a
product between three different product brands (A, B, C).
• To prevent any wonky suggestions, the testing is being done at two labs:
Lab Efficient and Lab Inefficient.
• It is assumed that both labs are following the same instructions for testing the brands.
• Each lab tested a random sample of ๐ = 6 products from each brand.
COMPARING LABS
Lab Efficient
Sample
1
2
3
4
5
6
Mean
A
10.21
10.25
10.24
9.8
9.77
9.73
10
B
11.32
11.2
11.4
10.5
10.68
10.9
11
Lab Inefficient
C
11.6
11.9
11.8
12.3
12.2
12.2
12
Sample
1
2
3
4
5
6
Mean
A
9.03
10.26
11.6
11.4
8.01
9.7
10
B
9.56
13.4
10.68
11.32
10.68
10.36
11
C
10.45
9.64
9.59
13.4
14.5
14.42
12
BETWEEN VS WITHIN VARIANCE
Lab Efficient
Sample
1
2
3
4
5
6
Mean
Variance
A
10.21
10.25
10.24
9.8
9.77
9.73
10
0.066
B
11.32
11.2
11.4
10.5
10.68
10.9
11
0.133
Lab Inefficient
C
11.6
11.9
11.8
12.3
12.2
12.2
12
0.076
Sample
1
2
3
4
5
6
Mean
Variance
A
9.03
10.26
11.6
11.4
8.01
9.7
10
1.916
B
9.56
13.4
10.68
11.32
10.68
10.36
11
1.710
C
10.45
9.64
9.59
13.4
14.5
14.42
12
5.569
USING ANOVA …
• Compares the between-sample variation to the within-sample variation.
• Lab Efficient has minimal between-sample and within-sample variation,
indicating there is a likely difference between Brands A, B, and C.
• Lab Inefficient, on the other hand, has large within-sample variation,
indicating there is not likely to be enough evidence to conclude there is a
difference between Brands A, B, and C.
WHAT WE MEAN BY “ONE-WAY”
• We are looking to see if there is a difference in the content
between brands, also known as an effect.
• The brand is considered one factor, and, within that one
factor, there are three levels (groups): Brands A, B, and C.
NULL HYPOTHESIS
There is no statistical difference between the means at each factor level
๐ป0 : ๐1 = ๐2 = โฏ = ๐๐ก
where ๐ก > 2
ALTERNATIVE HYPOTHESIS
At least one of the means is statistically different from another
๐ป1 : ๐๐ ≠ ๐๐
for some ๐ and ๐ where ๐ ≠ ๐
BACK TO THE PRODUCT COMPARISON
If we want to compare the product brands (A, B, C),
our statistical hypotheses are:
• ๐ป0 : ๐1 = ๐2 = ๐3
• ๐ป1 : ๐๐ ≠ ๐๐ where ๐ ≠ ๐
TEST STATISTIC
๐๐๐ก๐ค๐๐๐
๐๐๐๐ข๐
๐ฃ๐๐๐๐๐๐๐
๐น∗ =
๐ค๐๐กโ๐๐ ๐๐๐๐ข๐ ๐ฃ๐๐๐๐๐๐๐
TEST STATISTIC
๐๐๐๐ ๐๐๐ข๐๐๐ ๐๐๐๐๐ก๐๐๐๐ก (๐๐๐)
๐น =
๐๐๐๐ ๐๐๐ข๐๐๐ ๐ธ๐๐๐๐ (๐๐๐ธ)
∗
MEAN SQUARE TREATMENT (MST)
• The total variation due to the differences in the factor levels (groups)
• If there is little to no difference the MST will be very small
• If there is a noticeable difference the MST will be large
MEAN SQUARE ERROR (MSE)
• The total variation due to random (unknown) error
• The larger the MSE, the less likely a difference will be
seen between the factor levels (groups)
Source
Sum of
Squares
Degrees of
Freedom
Treatment
๐๐๐
๐ก−1
Error
๐๐๐ธ
๐ − 1 − (๐ก − 1)
Total
๐๐๐๐๐ก๐๐
๐−1
Mean Square
F-Statistic
๐๐๐
๐๐๐ =
๐ก−1
๐๐๐ธ
๐๐๐ธ =
๐ − 1 − (๐ก − 1)
๐๐๐
๐๐๐ธ
THE ONE-WAY ANOVA TABLE
Source
Sum Squares
Degrees of
Freedom
Mean Square
F-Statistic
Treatment
12.00
2
6.00
65.46
Error
1.38
15
0.092
Total
13.38
17
LAB EFFICIENT
ONE-WAY ANOVA TABLE
Source
Sum Squares
Degrees of
Freedom
Treatment
12.00
2
6
Error
45.98
15
3.07
Total
57.98
17
LAB INEFFICIENT
ONE-WAY ANOVA TABLE
Mean Square
F-Statistic
1.96
F-STATISTIC
๐๐๐
๐น∗ =
~ ๐น๐๐๐,๐๐๐ธ
๐๐๐ธ
BUT HOW DO WE DRAW A CONCLUSION?
• The p-value!
• We need to use the F-distribution to calculate the p-value…
๐(๐น > ๐น ∗ ) ~ ๐น๐๐๐,๐๐๐ธ
Source
Sum Squares
Degrees of
Freedom
Mean Square
F-Statistic
Treatment
12.00
2
6
65.46
Error
1.38
15
0.092
Total
13.38
17
LAB EFFICIENT
ONE-WAY ANOVA TABLE
CONCLUSION FOR LAB EFFICIENT
We reject the null hypothesis ๐ป0 : ๐1 = ๐2 = ๐3 and
conclude it is more likely one of the product brands
is different from another.
Source
Sum Squares
Degrees of
Freedom
Treatment
12
2
6
Error
45.98
15
3.07
Total
57.98
17
LAB INEFFICIENT
ONE-WAY ANOVA TABLE
Mean Square
F-Statistic
1.96
CONCLUSION FOR LAB INEFFICIENT
We fail to reject the null hypothesis ๐ป0 : ๐1 = ๐2 = ๐3 and
conclude there is not enough evidence to demonstrate
the product brands are different from another.
HOW MUCH DO YOU SLEEP?
Mean (๐ฆเดค๐. )
Sample Size
Lion
7.56
32
Badger
6.59
16
Raven / Eagle
6.83
27
Snake
6.57
7
Total / Grand
6.89
82
๐น๐๐๐ก๐๐ (๐๐๐๐๐ก๐๐๐๐ก) ๐ฟ๐๐ฃ๐๐
๐๐๐ ๐๐๐ฃ๐๐ก๐๐๐๐
๐๐๐ก๐๐๐
๐ด๐ฃ๐๐๐๐๐๐
1
๐ฆ11
๐ฆ12
…
๐ฆ1๐1
๐ฆ1.
๐ฆเดค1.
2
๐ฆ21
๐ฆ22
…
๐ฆ2๐2
๐ฆ2.
๐ฆเดค2.
โฎ
โฎ
โฎ
…
โฎ
โฎ
โฎ
๐ก
๐ฆ๐ก1
๐ฆ๐ก2
…
๐ฆ๐ก๐๐ก
๐ฆ๐ก.
๐ฆเดค๐ก.
๐ฆ..
๐ฆเดค..
Total Observations
Combined Average
*also known as “Factor”
LET’S BREAK “TREATMENT” DOWN…
Source
Sum of Squares
Degrees of Freedom
Mean Square
๐ก−1
๐๐๐
๐๐๐ =
๐ก−1
๐ก
Treatment*
๐๐๐ = เท ๐๐ ๐ฆเดค๐. − ๐ฆเดค.. 2
๐=1
๐๐๐ = 14.606
SUM OF SQUARES TREATMENT (SST)
Known as the “Between Group Sum of Squares”
๐ก
๐๐๐ = เท ๐๐ ๐ฆเดค๐. − ๐ฆเดค.. 2
๐=1
LET’S BREAK “TOTAL” DOWN…
Source
Sum of Squares
Degrees of Freedom
Total
๐๐๐๐๐ก๐๐ = เท(๐ฆ๐๐ − ๐ฆเดค.. )2
๐−1
๐,๐
๐๐๐๐๐ก๐๐ = 122.305
SUM OF SQUARES TOTAL (SSTOTAL)
๐๐๐๐๐ก๐๐ = เท(๐ฆ๐๐ − ๐ฆเดค.. )2
๐,๐
*also known as “Residuals”
LET’S BREAK “ERROR” DOWN…
Source
Sum of Squares
Error*
๐๐๐ธ = เท(๐ฆ๐๐ − ๐ฆเดค๐. )2
๐,๐
Degrees of Freedom
Mean Square
๐−1 − ๐ก−1
๐๐๐ธ
๐๐๐ธ =
๐−1 − ๐ก−1
๐๐๐ธ = 107.699
SUM OF SQUARES ERROR (SSE)
Known as the “Within Group Sum of Squares”
๐๐๐ธ = เท(๐ฆ๐๐ − ๐ฆเดค๐. )
๐,๐
2
Source
Sum of Squares
Degrees of Freedom
Treatment
Error
Total
THE ONE-WAY ANOVA TABLE
Mean Square
F-Statistic