Module 8 ANOVA or F Test

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

ALDERSGATE COLLEGE Instructional Module in Educational Statistics

Module 8: ANOVA or F-Test

Prerequisite Skills:  Skills in performing basic operation


in mathematics
 Skills in applying the strategies of
problem solving
 Skills in using Excel Stat Software
and interpreting its printouts
Instructors: Emerson Y. Castañeto

Overview

In this module, learners will examine the most commonly used statistical method for testing hypotheses about 3 or
more means –Analysis of Variance, which is usually shortened to ANOVA. This test presents the technique in simple
analysis of variance of data in one-way classification and discussions about several post ANOVA test.

Objectives

Upon completion of this module, Student-learners will be able to:


1. explain when ANOVA is used
2. perform ANOVA test
3. generate Excel printout for ANOVA
4. read and interpret Excel and printout for ANOVA
5. perform post ANOVA test
6. practice honesty in the interpretation of test results

Learning Focus

The One-Way Analysis of Variance (ANOVA)


In the previous discussions, the procedures for testing the means of two normal populations with both
known and unknown variances were discussed. Frequently, however, it is necessary to evaluate differences
among the parameters of several groups. For instance, you may be interested in testing the null hypothesis that
the mean final examination grades in Statistics of 4 classes, under the same teacher are not significantly different,
or that there is no significant difference in the average gasoline consumption of six cars traveling the same
distance.
You should, however, test three or more population means using the previously learned techniques, but
the process so cumbersome and time-consuming. For example, if five population means 𝑥̅𝐴 , 𝑥̅𝐵 ,𝑥̅𝐶 ,𝑥̅𝐷 ,𝑥̅𝐸 will
be test using the t-test, the following pairs will be compared:
𝑥̅𝐴 and 𝑥̅𝐵 𝑥̅𝐵 and 𝑥̅𝐷
𝑥̅𝐴 and 𝑥̅𝐶 𝑥̅𝐵 and 𝑥̅𝐸
𝑥̅𝐴 and 𝑥̅𝐷 𝑥̅𝐶 and 𝑥̅𝐷
𝑥̅𝐴 and 𝑥̅𝐸 𝑥̅𝐶 and 𝑥̅𝐸
𝑥̅𝐵 and 𝑥̅𝐶 𝑥̅𝐷 and 𝑥̅𝐸

Prepared by Emerson Y. Castañeto Page 1


ALDERSGATE COLLEGE Instructional Module in Educational Statistics

To test whether any particular two of five means are significantly different, use either the z-test or the t-
test, to make ten distinct comparisons. However, this section considers a more convenient technique, and it
involves testing the equality of several means of SIMULTANEOUSLY! This user-friendly technique is referred to as
the analysis of variance, ANOVA or the F-Test for some users.

ANOVA
The ANOVA is used to analyze or to test the significance of differences among the means of 3 or more
groups simultaneously. It is a method of subdividing the total variation in the outcome measurements into that,
which is attributable to differences among the groups and which is due to chance or attributable to inherent
variation within the groups.

Below is a diagram on partitioning the Total Variation.

Between Group Variation (𝑺𝑺𝒃 )


Due Treatment (𝑑𝑓𝑏 = 𝑘 − 1)
Total Variation (𝑻𝑺𝑺)
𝑑𝑓 = 𝑛 − 1
Within Group Variation (𝑺𝑺𝒘 )
Due to Error (𝑑𝑓𝑤 = 𝑑𝑓𝑡 − 𝑑𝑓𝑏 )

ANOVA was developed by Fisher, a famous statistician from whom the term F-test came. This section
presents the technique in simple analysis of variance of data in one-way classification or the One-Way ANOVA of
equal and unequal sample size. Always remember that in this method of testing the difference between means
simultaneously, the search stops when the decision arrives at is the acceptance of the hypothesis. If, however, the
decision arrives at is the rejection of the null, then the search continues to find out which pair accounts for the
difference. Either a t-test or any available post-ANOVA test will later be used to find out which group significantly
differs from the other.

Simple analysis of variance or One-Way ANOVA is based on two sources of variations, namely:
1. Actual difference of the means due to TREATMENT. This is represented by the sum of squares between
columns(𝑆𝑆𝑏 ).
2. Chance or experimental ERROR. This is represented by the sums of squares within columns (𝑆𝑆𝑤 )

For easy usage, the formulas minus the complicated mathematical notations are as follows:

(∑ 𝒙)𝟐
1. Total Sums of Squares: 𝑻𝑺𝑺 = ∑ 𝒙𝟐 − 𝑵

2. Sum of Squares Between Columns:


1 (∑ 𝑥)2
𝑆𝑆𝑏 = ∑(𝑠𝑢𝑚 𝑜𝑓 𝑒𝑎𝑐ℎ 𝑐𝑜𝑙𝑢𝑚𝑛)2 −
𝑛𝑜. 𝑜𝑓 𝑟𝑜𝑤𝑠 𝑁

3. Sum of Squares Within Columns:𝑺𝑺𝒘 = 𝑻𝑺𝑺 − 𝑺𝑺𝒃

4. Total Degree of Freedom: 𝒅𝒇𝒕 = 𝑵 − 𝟏

Prepared by Emerson Y. Castañeto Page 2


ALDERSGATE COLLEGE Instructional Module in Educational Statistics

5. Between Columns Degree of Freedom: 𝒅𝒇𝒃 = 𝒌 − 𝟏

6. Within Columns Degree of Freedom: 𝒅𝒇𝒘 = 𝒅𝒇𝒕 − 𝒅𝒇𝒃 or 𝑵 − 𝒌

7. Mean Sum Of Squares Between Columns:


𝑺𝑺𝒃
𝑴𝑺𝑺𝒃 =
𝒅𝒇𝒃
8. Mean Sum of Squares Within Columns:
𝑺𝑺𝒘
𝑴𝑺𝑺𝒘 =
𝒅𝒇𝒘
9. F-computed:
𝑴𝑺𝑺𝒃 where: 𝑁 = total number of samples
𝑭𝒄𝒐𝒎𝒑 = , 𝐹𝑐𝑜𝑚𝑝 = the computed value of 𝐹
𝑴𝑺𝑺𝒘
𝑘 = the number of columns or group
𝑑𝑓 = the degree of freedom

Under the assumption that the groups of levels of the factor being studied represent populations whose
outcome measurements are randomly and independently drawn, follow the normal distribution, and have equal
variances, the null hypothesis of no differences in the population means.

Ho: 𝜇1 = 𝜇2 = 𝜇3 = 𝜇4 … 𝜇𝑛 ; There is no significant difference among the means of the groups being
compared, and is tested against the alternative hypothesis that the means are not all the same, thus:
Ha: Not all means 𝜇’s equal.

The box to the left shows what a true hypothesis looks like when three groups are compared and the
assumptions of normally and equality of variances hold. The three populations representing the different levels of
the factor are identical and, therefore, super impose on one another.
On the other hand, the box on the right shows a null hypothesis which is false, that is 𝜇1 = 𝜇2 , but not
equal to 𝜇3 , that is 𝜇3 > 𝜇1 and therefore also 𝜇3 > 𝜇2 .

Prepared by Emerson Y. Castañeto Page 3


ALDERSGATE COLLEGE Instructional Module in Educational Statistics

Applications

Example 1.

Problem 1. The following table indicates the number of bottles of four popular brands of vinegar sold by
MS Supermarket on six randomly selected days. Test at 0.01 level of significance that there is
no significant difference in the average number of bottles sold for the four brands of vinegar.
A B C D
29 23 45 23
36 19 60 40
22 41 33 42
34 27 36 29
29 12 31 53
45 35 40 32
.

Solution:
1. Determine 𝒏 then compute for ∑ 𝒙 and ∑ 𝒙𝟐 . A table can facilitate your solution just like below.
A B C D
29 23 45 23
36 19 60 40
22 41 33 42
34 27 36 29
29 12 31 53
45 35 40 32 Total
𝑛(number of sample) → 6 6 6 6 24
∑ 𝑥 (sum of scores in a column) → 195 157 245 219 816
∑ 𝑥 2 (sum of the squares of each score in a column) → 6643 4669 10571 8567 30450
𝑆𝑆 (sum of the squares within column) → 305.50 560.833 566.833 573.50 2706

a. 𝑛𝑐𝑜𝑙𝑢𝑚𝑛𝐴 = 𝟔
b. ∑ 𝑥𝑐𝑜𝑙𝑢𝑚𝑛𝐴 = 𝟏𝟗𝟓 = 29 + 36 + 22 + 34 + 29 + 45
c. ∑ 𝑥 2 𝑐𝑜𝑙𝑢𝑚𝑛𝐴 = 𝟔𝟔𝟒𝟑 = 292 + 362 + 222 + 342 + 292 + 452
2 2
( ∑ 𝑥𝐴 ) (195)
d. 𝑆𝑆𝑐𝑜𝑙𝑢𝑚𝑛𝐴 = ∑ 𝑥𝐴 2 − 𝑁𝐴
= 𝟑𝟎𝟓. 𝟓 = 6643 − 6

2. Compute for Sum of Squares Within Columns(𝑆𝑆𝑤 ):


𝑺𝑺𝒘 = 𝑺𝑺𝑨 + 𝑺𝑺𝑩 + 𝑺𝑺𝑪 + 𝑺𝑺𝑫
= 305.50 + 560.833 + 566.833 + 573.50 = 𝟐𝟎𝟎𝟔. 𝟕

3. Compute the Total Sums of Squares(𝑇𝑆𝑆):


(∑ 𝒙)𝟐 𝑻 (816)2
𝑻𝑺𝑺 = ∑ 𝒙𝟐 𝑻 − = 30450 − = 𝟐𝟕𝟎𝟔
𝑵𝑻 24

4. Compute for Sum of Squares Between Columns(𝑆𝑆𝑏 ):


𝑺𝑺𝒃 = 𝑻𝑺𝑺 − 𝑺𝑺𝒘 = 2706 − 2006.7 = 𝟔𝟗𝟗. 𝟑

Prepared by Emerson Y. Castañeto Page 4


ALDERSGATE COLLEGE Instructional Module in Educational Statistics

5. Determine the Total Degree of Freedom: (𝑑𝑓𝑇 )


𝒅𝒇𝑻 = 𝑵 − 𝟏 = 24 − 1 = 𝟐𝟑

6. Determine Between Column Degree of Freedom(𝑑𝑓𝑏 ):


𝒅𝒇𝒃 = 𝒌 − 𝟏 = 4 − 1 = 𝟑

7. Determine Within Columns Degree of Freedom(𝑑𝑓𝑤 ):


𝒅𝒇𝒘 = 𝒅𝒇𝑻 − 𝒅𝒇𝒃𝒈 = 23 − 3 = 𝟐𝟎
or 𝒅𝒇𝒘 = 𝑵 − 𝒌 = 24 − 4 = 𝟐𝟎

8. Solve for the Mean Sum of Squares Between Columns(𝑀𝑆𝑆𝑏 ):


𝑺𝑺𝒃 699.3
𝑴𝑺𝑺𝒃 = = = 𝟐𝟑𝟑. 𝟏
𝒅𝒇𝒃 3
9. Solve for the Mean Sum of Squares Within Columns(𝑀𝑆𝑆𝑤 ):
𝑺𝑺𝒘 2006.7
𝑴𝑺𝑺𝒘 = = = 𝟏𝟎𝟎. 𝟑𝟑𝟓
𝒅𝒇𝒘 20
10. Finally, Solve for the F-ratio ( F ):
𝑴𝑺𝑺𝒃 233.1
𝑭𝒄𝒐𝒎𝒑 = = = 𝟐. 𝟑𝟐𝟑
𝑴𝑺𝑺𝒘 100.335

Here is the 5-step solution (Critical Value Approach)


1. Ho: 𝜇𝐴 = 𝜇𝐵 = 𝜇𝐶 = 𝜇𝐷 ; There is no significant difference in the average number of bottles of
vinegar sold.
Ha: 𝜇𝐴 ≠ 𝜇𝐵 ≠ 𝜇𝐶 ≠ 𝜇𝐷 ; Not all 𝜇’s are equal or at least one pair of means is significantly
different. There is significant difference in the average number of bottles of vinegar sold.
2. 𝛼 = 0.01, two-tailed test, critical value = 4.938
3. Decision Rule: Reject Ho, if |𝐹𝑐𝑜𝑚𝑝 | ≥ |𝐹𝑡𝑎𝑏 |, that is if |2.323| ≥ |4.938|.
4. Decision: Do not reject Ho, because 2.323 < 4.938.
5. Conclusion: There is no significant difference in the average number of bottles of vinegar sold.

The Critical value or Tabular F-value (with dfw=20 and dfb=3) shown below can be calculated online
through this link https://www.socscistatistics.com/tests/criticalvalues/default.aspx.

Prepared by Emerson Y. Castañeto Page 5


ALDERSGATE COLLEGE Instructional Module in Educational Statistics

The problem above has this Megastat output for ANOVA.

Here is the 5-step solution ( p-value Approach)


1. Ho: 𝜇𝐴 = 𝜇𝐵 = 𝜇𝐶 = 𝜇𝐷 ;There is no significant difference in the average number of bottles of
vinegar sold.
Ha: Not all 𝜇’s are equal or at least one pair of means is significantly different. There is
significant difference in the average number of bottles
2. 𝛼 = 0.01, two-tailed, p-value = 0.1058
3. Decision Rule: Reject Ho, if 𝑝 − 𝑣𝑎𝑙𝑢𝑒(0.1058) ≤ 𝛼(0.01)
4. Decision: Do not reject Ho, because 0.1058 > 0.01.
5. Conclusion: There is no significant difference in the average number of bottles of vinegar sold.

You can see that the results of the test of the significance of the differences of the means is the same for
both (critical and p-value) approaches. Both resulted to the non-rejection of the hypothesis.

Since the decision arrived at is not reject Ho, your job ends here.

Prepared by Emerson Y. Castañeto Page 6


ALDERSGATE COLLEGE Instructional Module in Educational Statistics

Example 2.

Problem 2. The table shows the amount of dirt in milligrams that the brands of laundry detergent have
removed. Test at 𝜶 = 𝟎. 𝟎𝟓. If there is a significant difference among the mean amounts of dirt
removed by the four brands of laundry detergent.
Brand W Brand X Brand Y Brand Z
10 11 10 17
12 13 11 15
16 16 15 17
16 18 14 19
14 20 13 21
.

Solution:
1. Determine 𝑛 then compute for ∑ 𝑥 and ∑ 𝑥 2 . A table can facilitate your solution just like below.

Brand W Brand X Brand Y Brand Z


10 11 10 17
12 13 11 15
16 16 15 17
16 18 14 19
14 20 13 21 Total
𝑛(number of sample) → 5 5 5 5 20
∑ 𝑥 (sum of scores in a column) → 68 785 63 89 298
∑ 𝑥 2 (sum of the squares of each score in a column) → 952 1270 811 1605 4638
𝑆𝑆(sum of the squares within column) → 27.2 53.2 17.2 20.8 197.8

a. 𝑛𝑏𝑟𝑎𝑛𝑑𝑊 = 5
b. ∑ 𝑥𝑏𝑟𝑎𝑛𝑑𝑊 = 68 = 10 + 12 + 16 + 16 + 14
c. ∑ 𝑥 2 𝑏𝑟𝑎𝑛𝑑𝑊 = 952 = 102 + 122 + 162 + 162 + 142
2
(68)
d. 𝑆𝑆𝑐𝑜𝑙𝑢𝑚𝑛𝑊 = 27.2 = 952 − 5

2. Compute for Sum of Squares Within Columns (𝑆𝑆𝑤𝑔 ):


𝑺𝑺𝒘𝒈 = 𝑺𝑺𝑾 + 𝑺𝑺𝑿 + 𝑺𝑺𝒀 + 𝑺𝑺𝒁 = 27.2 + 53.2 + 17.2 + 20.8 = 𝟏𝟏𝟖. 𝟒
3. Compute the Total Sums of Squares(𝑇𝑆𝑆):
2
(∑ 𝑥)2 𝑇 (298)
𝑇𝑆𝑆 = ∑ 𝑥 − 2
= 4638 − = 197.8
𝑇 𝑁𝑇 20
4. Compute for Sum of Squares Between Columns(𝑆𝑆𝑏𝑔 ):
𝑆𝑆𝑏𝑔 = 𝑇𝑆𝑆 − 𝑆𝑆𝑤𝑔 = 197.8 − 118.4 = 79.4
5. Determine the Total Degree of Freedom: (𝑑𝑓𝑇 )
𝑑𝑓𝑇 = 𝑁 − 1 = 20 − 1 = 19
6. Determine Between Column Degree of Freedom(𝑑𝑓𝑏𝑔 ):
𝑑𝑓𝑏𝑔 = 𝑘 − 1 = 4 − 1 = 3

Prepared by Emerson Y. Castañeto Page 7


ALDERSGATE COLLEGE Instructional Module in Educational Statistics

7. Determine Within Columns Degree of Freedom(𝑑𝑓𝑤𝑔 ):


𝑑𝑓𝑤𝑔 = 𝑑𝑓𝑇 − 𝑑𝑓𝑏𝑔 = 19 − 3 = 16
or 𝑑𝑓𝑤𝑔 = 𝑁 − 𝑘 = 20 − 4 = 16
8. Solve for the Mean Sum of Squares Between Columns(𝑀𝑆𝑆𝑏 ):
𝑆𝑆𝑏𝑔 79.4
𝑀𝑆𝑆𝑏𝑔 = = = 26.46666667
𝑑𝑓𝑏𝑔 3
9. Solve for the Mean Sum of Squares Within Columns (𝑀𝑆𝑆𝑤 ):
𝑆𝑆𝑤𝑔 118.4
𝑀𝑆𝑆𝑤𝑔 = = = 7.4
𝑑𝑓𝑤𝑔 16
10. Finally, Solve for the F-ratio:
𝑀𝑆𝑆𝑏𝑔 26.46666667
𝐹𝑐𝑜𝑚𝑝 = = = 3.576577
𝑀𝑆𝑆𝑤𝑔 7.4

Here is the 5-step solution (Critical Value Approach)

1. Ho: 𝜇𝑊 = 𝜇𝑋 = 𝜇𝑌 = 𝜇𝑍 ; There is no significant difference among the mean amounts of dirt


removed by the four brands of laundry detergent.
Ha: 𝜇𝑊 ≠ 𝜇𝑋 ≠ 𝜇𝑌 ≠ 𝜇𝑍 ; Not all the mean amounts of dirt removed by the four brands of
detergent are equal, or not all𝜇’s are equal or There is significant difference among the mean
amounts of dirt removed by the four brands of laundry detergent.
2. 𝛼 = 0.05; two tailed test ; critical value = 3.239
3. Decision Rule: Reject Ho, if |𝐹𝑐𝑜𝑚𝑝 | ≥ |𝐹𝑡𝑎𝑏 |, that is if |3.576577| ≥ |3.239|.
4. Decision: Reject Ho, because 3.576577 > 3.239.
5. Conclusion: There is significant difference among the mean amounts of dirt removed by the four
brands of laundry detergent; or not all the mean amounts of dirt removed by the four brands of
detergent are equal.

The Critical value or Tabular F-value (with dfw=16 and dfb=3) shown below can be calculated online
through this link https://www.socscistatistics.com/tests/criticalvalues/default.aspx.

Prepared by Emerson Y. Castañeto Page 8


ALDERSGATE COLLEGE Instructional Module in Educational Statistics

Below is the Megastat output for the amount of dirt by the four types of laundry detergent.

Here is the 5-step solution ( p-Value Approach)

1. Ho: 𝜇𝑊 = 𝜇𝑋 = 𝜇𝑌 = 𝜇𝑍 ; There is no significant difference among the mean amounts of dirt


removed by the four brands of laundry detergent.
Ha: 𝜇𝑊 ≠ 𝜇𝑋 ≠ 𝜇𝑌 ≠ 𝜇𝑍 ; Not all the mean amounts of dirt removed by the four brands of
detergent are equal, or not all𝜇’s are equal or There is significant difference among the mean
amounts of dirt removed by the four brands of laundry detergent.
2. 𝛼 = 0.05; two tailed test; p-value = 0.0376
3. Decision Rule: Reject Ho,
if 𝑝 − 𝑣𝑎𝑙𝑢𝑒 (0.0376) ≤ 𝛼(0.05)
4. Decision: Reject Ho, because 0.0376 < 0.05.
5. Conclusion: There is significant difference among the mean amounts of dirt removed by the four
brands of laundry detergent; or not all the mean amounts of dirt removed by the four brands of
detergent are equal.

Now since the decision leads to the rejection of Ho, then you have to continue searching which pair or
pairs significantly differ from each other. Remember that if the decision is not to reject Ho, then you are done; your
job is finished.

Post ANOVA Test


There are several post ANOVA test available. These include the t-test, Tukey’s HSD (Honestly Significant
Difference), LSD (Least Significance Difference) and the Duncan’s Multiple Range Test. But in this test, only the t-
test will be tackled.

The t-test as post-ANOVA Test

At this point, you are already familiar with the t-test, you will employ it to look for the pair or pairs of
laundry detergent which are significantly different from each other. Be guided by the following steps:

Prepared by Emerson Y. Castañeto Page 9


ALDERSGATE COLLEGE Instructional Module in Educational Statistics

Step 1. Arrange the means from the lowest to highest, writing them from left to right.
𝑌̅ ̅
𝑊 𝑋̅ 𝑍̅
12.6 13.6 15.6 17.8
Step 2.𝛼 = 0.05(This is the 𝛼 in the ANOVA problem); One-tailed test(since you know that the means on
the right are greater than the means on the left)
Step 3. Perform “t-test for Sample Means Assuming Equal Variances” on each pair starting from the right
to the left, that is: 𝑍̅and𝑋̅; 𝑍̅and𝑊
̅ ; 𝑍̅ and𝑌̅; 𝑋̅ and𝑊
̅ ; 𝑋̅ and𝑌̅; 𝑊
̅ and𝑌̅.

Printouts follow:

Prepared by Emerson Y. Castañeto Page 10


ALDERSGATE COLLEGE Instructional Module in Educational Statistics

Step 4. Analysis
a) 𝑍̅ and 𝑌̅: p-value (0.002723)<𝛼(0.05), Ho is rejected-There is significant difference.
b) 𝑍̅ and 𝑊̅ : p-value (0.013307)<𝛼(0.05), Ho is rejected-There is significant difference.
̅ ̅
c) 𝑍 and 𝑋: p-value (0.142902)>𝛼(0.05), Ho is not rejected-There is no significant difference.
d) 𝑋̅ and 𝑊̅ : p-value (0.173864)>𝛼(0.05), Ho is not rejected-There is no significant difference.
e) 𝑋̅ and 𝑌̅: p-value (0.074243)>𝛼(0.05), Ho is not rejected-There is no significant difference.
f) 𝑊̅ and 𝑌̅: p-value (0.260512)>𝛼(0.05), Ho is not rejected-There is no significant difference.

Step 5. Line Analysis


 If the means are underlined, then they are not significantly different and if the means are not
underlined, then they are significantly different.
𝑌̅ ̅
𝑊 𝑋̅ 𝑍̅
12.6 13.6 15.6 17.8

Step 6. Conclusion: Since Z and X removed the most amount of dirt and they are significantly
different from each other, then they are found to be the best among the four brands of laundry
detergent.

Prepared by Emerson Y. Castañeto Page 11

You might also like