Applied Statistics I
STAT 151
Module 9
By Haile Gessesse
1
9 One way ANOVA
Goal: We discuss how to make confidence interval estimates of
means and how to perform hypothesis tests for one population
mean, two population means, and several populations.
• Analysis of variance (ANOVA) provides methods for com-
paring several population means, that is, the means of a single
variable for several populations.
• For example, suppose that you want to compare the mean en-
ergy consumption by households among the four regions of the
United States.
2
• Analysis-of-variance procedures rely on a distribution called the
F -distribution.
F -Distribution
• A variable is said to have an F -distribution if its distribution
has the shape of a special type of right-skewed curve, called an
F-curve, where its degree of freedom is given as df = (m, n).
Properties of F -curves:
• Property 1) The total area under an F -curve is one.
• Property 2) An F -curve starts at 0 on the horizontal axis
and extends indefinitely to the right, approaching, but never
touching, the horizontal axis as it does so.
• Property 3) An F -curve is right skewed.
3
• To perform an ANOVA test, we need to know how to find the
F -value having a specified area to its right.
• The symbol Fω denotes the F -value having area ω to its right.
Example: Find the F0.05 (the F -value where the area to its
right is 0.05) with df = (4, 12).
4
One-Way ANOVA
• one-way analysis of variance compares the means of a variable
for populations that result from a classification by one other
variable, called the factor.
Assumptions:
1. Simple random samples: The samples taken from the popu-
lations under consideration are simple random samples.
2. Independent samples: The samples taken from the popula-
tions under consideration are independent of one another.
3. Normal populations: For each population, the variable under
consideration is normally distributed. (Use qq plots).
4. Equal standard deviations: The standard deviations of the
variable under consideration are the same for all the pop-
ulations. (The ratio of the largest to the smallest sample
standard deviation is less than 2).
5
Mean Squares and F -Statistic
• Suppose there are k number of population and we want to com-
pare their means.
• First we define some measurements formulas for samples with
sizes n1, n2, ...., nk taken from each population with respective
sample means and standard deviations x1, x2, .... , xk , s1, s2,
.... , sk :
• Treatment mean square, M ST R: The variation among the
sample means:
M ST R = SST R/(k → 1)
where
SST R = n1(x̄1 → x̄)2 + · · · + nk (x̄k → x̄)2
and x is the mean of all sample data.
• The quantity SST R is called the treatment sum of squares.
x can also be computed as x = n1x̄1+···+n
n
k x̄k
.
6
• Error mean square, M SE: The variation within the samples:
M SE = SSE/(n → k),
where
SSE = (n1 → 1)s21 + · · · + (nk → 1)s2k .
The quantity SSE is called the error sum of squares.
• F -statistic, F : The ratio of the variation among the sample
means to the variation within the samples:
M ST R
F =
M SE
which has the F -distribution with
df = (k → 1, n → k) and n = n1 + · · · + nk .
7
• Large values of F indicate that the variation among the sample
means is large relative to the variation within the samples and
hence that the null hypothesis of equal population means should
be rejected.
One-Way ANOVA Identity
• The total sum of squares (SST ) is defined as
!
SST = (xi → x̄)2
which equals the treatment sum of squares plus the error sum
of squares:
SST = SST R + SSE
This equation is called one-way anova identity.
8
One-Way ANOVA table
• The one-way ANOVA table has the form:
• This table has an importance in doing anova test.
9
Procedure: To perform a hypothesis test to compare k popu-
lation means: µ1, µ2, . . . , and µk .
Assumptions: The four assumptions for one way ANOVA test.
• (Step 1) State H0 and HA
H0 :µ1 = µ2 = · · · = µk
HA : At least two of means are not equal.
• (Step 2) Decide on the significance level, ω.
• (Step 3) Compute the value of the test statistic
M ST R
F0 =
M SE
• (Step 4) Find the p-value from the F-distribution with df=(k →
1, n → 1).
If p-value ↑ ω, we reject H0; otherwise,we do not reject H0.
• (Step 5) Interpret the results of the hypothesis test.
10
Example: Three models of automobiles were tested for fuel
e!ciency as follows. Exactly three litres of gasoline were placed
in the gasoline tank of a car. The car was then driven until the
fuel was used up. The number of kilometres traveled for each
model was recorded for several tests each. The following data
were collected.
Model A Model B Model C
Sample size n1 = 4 n2 = 6 n3 = 8
Sample means x̄1 = 18 x̄2 = 16 x̄3 = 20.25
Sta. dev. s̄1 = 1.633 s̄2 = 1.414 s̄3 = 2.053
Assuming the four assumptions for ANOVA test are satisfied, is
there any di”erence in average distance traveled on 3 litres of
fuel for at least two of these three models at a significance level
of 1%.
Solution: If the four assumptions are true, then we can directly
go to the 5 steps of the ANOVA test.
• (Step 1) State H0 and HA
H 0 : µ1 = µ2 = µ3
HA : At least two of the three car models have
di”erent average distance traveled on 3 litres of fuel.
11
• (Step 2) We are to perform the test at 1% significance level;
so, ω = 0.01.
• (Step 3) Compute the test statistic: F0 = M ST R
M SE .
n = n1 + n2 + n3 = 18.
n1x̄1 + n2x̄2 + n3x̄3
x̄ =
n
4(18) + 6(16) + 8(20.25)
=
18
=18.33
n1(x̄1 → x̄)2 + n2(x̄2 → x̄)2 + n3(x̄3 → x̄)2
M ST R =
k→1
4(18 → 18.33) + 6(16 → 18.33)2 + 8(20.25 → 18.33)2
2
=
3→1
=31.25
(n1 → 1)s21 + (n2 → 1)s22 + (n3 → 1)s23
M SE =
n→k
3(1.633) + 5(1.414)2 + 7(2.053)2
2
=
18 → 3
=3.17
F0 = MMST R
SE = 31.25/3.17 = 9.86 with numerator df1 = 2 and
denominator df2 = 15.
• (Step 4) Find the p-value, using R,
p-value = pf(9.86, 2,15, [Link]=FALSE) = 0.0019
which is smaller than ω = 0.01. So we reject H0.
12
• (Step 5) Interpret your result
Interpretation: At 1% significance level, the data supports
that there is di”erence in average distance traveled on 3 litres
of fuel between at least two of these three models.
13
Example: Independent simple random samples of households
in the four U.S. regions yielded the data on last year’s energy
consumptions shown in the table below. At the 5% significance
level, do the data provide su!cient evidence to conclude that
a di”erence exists in last year’s mean energy consumption by
households among the four U.S. regions?
Solution: First, we check the four assumptions required for
performing a one-way ANOVA test.
1. The samples are given as simple random samples and, there-
fore, Assumption 1 is satisfied.
2. The samples are given as independent samples and, therefore,
Assumption 2 is satisfied.
3. Normal probability plots of the four samples, presented, show
no outliers and are roughly linear, indicating no gross vio-
lations of the normality assumption; thus we can consider
Assumption 3 satisfied.
14
4. The sample standard deviations of the four samples are 1.87,
2.59, 3.00, and 1.92, respectively. The ratio of the largest to
the smallest standard deviation is 3.00/1.87 = 1.60, which
is less than 2. Thus, we can consider Assumption 4 satisfied.
• (Step 1) State H0 and HA
H0 :µ1 = µ2 = µ3 = µ4
HA : Not all the means are equal.
• (Step 2) We are to perform the test at the 5% significance
level; so, ω = 0.05.
• (Step 3) Compute the test statistic: F0 = M ST R
M SE by forming
the anova table.
So, from the ANOVA table F0 = 6.318.
15
• (Step 4) We find the p-value, using R,
p-value = pf(6.32, 3,16, [Link]=FALSE)
= 0.00495
p-value = 0.00495< ω = 0.05, so we reject the null hypothesis.
• (Step 5) Interpret
Interpretation: At the 5% significance level, the data provide
su!cient evidence to conclude that a di”erence exists in last
year’s mean energy consumption by households among the four
U.S. regions. Evidently, at least two of the regions have di”erent
mean energy consumptions.
16
Bibliography
M. F. Triola, Elementary Statistics, 12th Edition, Pearson
N. A. Weiss, Introductory Statistics, 9th Edition,
17