SlideShare a Scribd company logo
2
Most read
4
Most read
8
Most read
www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA
CHAPTER 13 – TWO-WAY ANALYSIS OF VARIANCE
Two-way ANOVA has many of the same ideas as one-way ANOVA, with
the main difference being the inclusion of another factor (or explanatory
variable) in our model.
In the two-way ANOVA model, there are two factors, each with its own
number of levels. When we are interested in the effects of two factors, it is
much more advantageous to perform a two-way analysis of variance, as
opposed to two separate one-way ANOVAs.
There are three main advantages of two-way ANOVA:
- It is more efficient to study two factors simultaneously rather than
separately.
- We can reduce the residual variation in a model by including a
second factor thought to influence the response.
- We can investigate interactions between factors.
The interaction between two variables is usually the most interesting
feature of a two-way analysis of variance. When two factors interact, the
effect on the response variable of one explanatory variable depends on the
specific value or level of the other explanatory variable.
For example, the statement “being overweight caused greater increases in
blood pressure for men than for women” is a statement describing
interaction. The effect of weight (factor #1, categorical – overweight or not
overweight) on blood pressure (response) depends on gender (factor #2,
categorical – male or female).
The term main effect is used to describe the overall effect of a single
explanatory variable. For our previous example, there would be two main
effects: the effect of weight on blood pressure and the effect of gender on
blood pressure.
1
www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA
The presence of a main effect might not necessarily be useful when an
interaction effect exists. For example, it might be sensible to report the
effect of being overweight on blood pressure without reporting that there is a
difference in the effect of being overweight on blood pressure for men and
women.
There are many types of interactions which can often be seen from patterns
in graphs. We will study some types in the following examples.
Example #1(a)
The Bureau of Labor Statistics collects data on earnings of workers in the
US classified according to various characteristics. Here are the mean weekly
earnings in dollars of men and women in two age groups who were working
full-time in the first quarter of 1997:
Age Women Men Mean
16-19
20-24
239
302
264
333
251.5
317.5
Mean 270.5 298.5 284.5
Figure 13.1 is a plot of the group
means. It clearly shows an existence of
main effects.
From the plot we can see that on
average men earn more than women
indicating an effect of gender. We can
also see an effect of age since the older
groups makes on average more than the
younger age group.
What about the interaction between
gender and age?
An interaction is present when the
main effects cannot provide a complete
description of the data.
Figure 13.1
2
www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA
In our graph, the only two effects that are present are an effect due to age and
an effect due to gender. We know that men make, on average, more than
women, but there is no dependence on age to determine the amount that men
make more than women. Therefore, since there is no dependence between
gender and age, there is no interaction effect.
Parallel lines in our plot usually imply little or no interaction.
Example #1 (b)
The survey described in 1(a) also gave weekly earnings for groups of older
workers. Here is the complete table:
Figure 13.2
Age Women Men Mean
16-19
20-24
25-34
35-44
45-54
55-64
239
302
422
475
496
426
264
333
514
639
692
660
251.5
317.5
468.0
557.0
594.0
543.0
Mean 393 517 455.0
Figure 13.2 is a plot of the group means. It demonstrates both main effects
and an interaction between gender and age.
In this case, the main effects do not provide a complete description of the data
since now the gender difference in earnings depends on which age group we
examine. As the age of the workers increases, the earnings increase (except in
the last age group). We also see a main effect of gender on earnings.
However, our interaction shows that the amount by which the men earn over the
women depends on the age group.
Therefore, there is a very strong interaction present and our main effects don’t
provide us with enough information to get an accurate idea of the relationship
between age and earnings as well as gender and earnings.
3
www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA
Example #2
A study of the energy expenditure of farmers in Burkina Faso collected data
during the wet and dry seasons. The farmers grow millet during the wet
season. In the dry season there is very little activity because the ground is
too hard to grow crops. The mean energy expended (in calories) by men
and women in Burkina Faso during the wet and dry seasons is given in the
following table:
Season Men Women Mean
Dry
Wet
2310
3460
2320
2890
2315
3175
Mean 2885 2605 2745
During the dry season both men and women
use about the same amount of energy.
However, during the wet season, both
genders burn more calories. Therefore, there
is an effect of season on the number of
calories burned.
During the wet season, since it is the custom
for men to do most of the field work, they
use more energy on average than women.
Therefore, there is an effect of gender on the
number of calories burned, but only in the
wet season.
So there is an interaction between gender
and season, as well as main effects of both
factors.
Figure 13.3
4
www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA
THE TWO-WAY ANOVA MODEL
When discussing two-way ANOVA models, we will use the labels A and B
to represent our two factors. In examples, we will use the factor names so
that we can easily see the meaning of each variable.
We use I to represent the number of levels of factor A and J to represent the
number of levels of factor B. Therefore, we call the general two-way
problem an I x J ANOVA, since every level of A is combined with every
level of B, so that I x J groups are compared.
The sample size for level i of factor A and level j of factor B is nij. The total
number of observations is N = Σ nij.
Example #3
A company wants to compare three different training programs for its new
employees. Each of these programs takes 8 hours to complete. The training
can be given for 8 hours on one day or for 4 hours on two consecutive days.
The next 120 employees that the company hires will be the subjects for this
study. After the training is completed, the employees are asked to evaluate
the effectiveness of the program on a 7-point scale. Identify the response and
explanatory variables, state the number of levels for each factor (I and J) and
the total number of observations (N).
5
www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA
Solution:
Explanatory variables:
1) Training program (I = 3 levels)
2) The manner in which the employee does the training (J = 2 levels: 8
hrs f or one day, 4 hrs on two consecutive days).
Response variable: the 7-point scaled effectiveness score
Total number of observations N = 120
_____________________________________________________________
For our two-way ANOVA, we assume to have independent SRSs of size nij
from each of I x J normal populations. The population means µij may differ,
but all populations must have the same standard deviation σ.
Let xijk be the kth
observation from the population having factor A at level i
and factor B at level j. Since our observations differ from their mean by a
value of εijk (xijk – µij = εijk), we can write our two-way ANOVA model in
the form: xijk = µij + εijk.
In this case, i = 1,2, …, I, j = 1,2,…, J, k = 1,2,…,nij and the deviations εijk
are normally distributed with mean 0 and standard deviation σ.
As in the previous chapters, we can describe our model by DATA = FIT +
RESIDUAL. In this case, the fit part of our model is the means µij, (since
we use each mean to describe each population) and the residual part is the
deviations εijk of the individual observations from their group means.
Our population means µij and the population standard deviations are all
unknown. Therefore, we pick simple random samples (SRSs) to learn about
the relationship between our factors and the response in our samples and
then use that to estimate the relationship in our population.
6
www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA
PARAMETER ESTIMATES
The population mean for the group with level i of factor A and level j of
factor B is represented by µij. It can be estimated by
1
1 ijn
ij ijk
ij k
x x
n =
= ∑ .
Since every σ (population standard deviation) is assumed to be the same in
two-way ANOVA, we can pool all of our estimates (sample standard
deviations) to give one estimate of the population standard deviation.
2
2 ( 1)
( 1)
ij ij
p
ij
n s
s
n
−
=
−
∑
∑ and
2
p ps s=
Just like in one-way ANOVA, sp
2
= MSE, and so the numerator of sp
2
is
equal to SSE and the denominator is equal to DFE (since we have ( 1ijn )−∑ =
N - IJ, so we have N observations being compared to IJ sample means).
7
www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA
Example #4
Students in a statistics class gave information on their height and weight and
also reported their perception of their weight (about right, underweight,
overweight). The body mass index, BMI, was calculated for each
combination of student gender and perception of weight category (BMI =
Weight/Height). Calculate each sample mean based on the data.
Perception of Weight
Underweight About Right Overweight
Female 20.2 20.6 18.1 21.4 22.5 23.1 20.9 24.5 26.0 22.7 24.6
Male 23.8 20.5 23.4 26.5 22.2 24.0 28.1 26.4 27.7
Solution:
Let factor A be the perception of weight and let factor B be gender. Within
factor A, let level 1 be underweight, level 2 be about right, and level 3 be
overweight. Within factor B (gender), let level 1 be female and let level 2 be
male. So µ11 corresponds to the population mean BMI of underweight
females, µ12 corresponds to the population mean BMI of underweight males,
and so on. So to estimate these population values, we use xij(bar) to estimate
µij for i=1,2,3 and j=1,2.
Now,
x11(bar) = (20.2 + 20.6 + 18.1 + 21.4) / 4 = 20.075
x12(bar) = (23.8 + 20.5) / 2 = 22.15
x21(bar) = (22.5 + 23.1 + 20.9) / 3 = 21.167
x22(bar) = (23.4 + 26.5 + 22.2 + 24.0) / 4 = 24.025
x31(bar) = (24.5 + 26 + 22.7 + 24.6) / 4 = 24.45
x32(bar) = (28.1 + 26.4 + 27.7) / 3 = 27.4
Note: (bar) just means that the x has a bar over it (indicating a mean).
8
www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA
TWO-WAY ANOVA TABLE
In two-way ANOVA, there are three F statistics that are calculated and used
in significance tests: two that test for the main effects and one that tests for
an interaction.
Therefore, the sum of squares for our FIT (SSM) is made up of three parts:
SSA - sum of squares for factor A
SSB - sum of squares for factor B
SSAB - sum of squares for the interaction between factor A
and factor B
Our total sum of squares and total degrees of freedom are still the sum of the
sources of variation and degrees of freedom in our model.
SST = SSA + SSB + SSAB + SSE
DFT = DFA + DFB + DFAB + DFE
When our sample sizes are different, do not be alarmed if our sums of
squares do not add up to our given SST. When our sample sizes are
different, this can cause sums of squares which don’t add.
Since we have I levels of factor A, DFA = I – 1.
Since we have J levels of factor B, DFB = J – 1.
Since SSM = SSA + SSB + SSAB and DFM = IJ – 1,
DFAB = (IJ – 1) – (I – 1) – (J – 1) = (I – 1)( J – 1).
DFE = N – IJ (we have N observations and IJ sample means)
DFT = N – 1
9
www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA
TWO-WAY ANOVA TABLE
Source
Degrees of
Freedom Sums of Squares Mean Square F
A I – 1 SSA SSA/DFA MSA/MSE
B J – 1 SSB SSB/DFB MSB/MSE
AB (I – 1)(J – 1) SSAB SSAB/DFAB MSAB/MSE
Error N – IJ SSE SSE/DFE
Total N - 1 SST
Remember that when we do a two-way ANOVA, we need to assume that
our data is normally distributed and that the population standard
deviations are equal.
Therefore, we must make sure that twice our smallest sample standard
deviation is larger than our largest standard deviation.
10
www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA
HYPOTHESES FOR TWO-WAY ANOVA
To test the main effect of A:
H0: No main effect of A Ha: There exists a main effect of factor A
F = MSA Compare to F(I-1, N-IJ)
MSE
To test the main effect of B:
H0: No main effect of B Ha: There exists a main effect of factor B
F = MSB Compare to F(J-1, N-IJ)
MSE
To test the interaction of A and B:
H0: No interaction Ha: There exists an interaction between factor A and
factor B
F = MSAB Compare to F((I-1)(J-1), N-IJ)
MSE
11
www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA
Example #5
When a restaurant server writes a friendly note or draws a “happy face” on
your restaurant check, is this just a friendly act or is there a financial
incentive? Psychologists conducted a randomized experiment to investigate
whether drawing a happy face on the back of a restaurant bill increased the
average tip given to the server. One female server and one male server in a
Philadelphia restaurant either did or did not draw a happy face on checks
during the experiment. In all they drew happy faces on 45 checks and did not
draw happy faces on 44 checks. The sequence of drawing the happy faces or
not was random.
a) Identify the response and explanatory variables, state the number of levels
for each factor (I and J) and the total number of observations (N).
Solution:
Response variable: tip
Explanatory variables: gender of server (2 levels), message (2 levels, yes or
no)
Total number of observations: N = 89
b) Complete the following two-way ANOVA table and then perform the
appropriate F tests for main effects and interaction and state your
conclusions.
Try to fill the table in on your own (answer is below):
Source DF SS MS F
Message 14.7
Gender 2602.0
Interaction 438.7
Error 109.8
Total 12407.9
12
www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA
Solution:
Source DF SS MS F
Message 1 14.7 14.7 0.134
Gender 1 2602.0 2602.0 23.7
Interaction 1 438.7 438.7 4.0
Error 85 9333.0 109.8
Total 88 12407.9 ---
H0: No main effect of message
Ha: A main effect of message exists
Test Statistic: F0 = 14.7/109.8 = 0.134 with numerator degrees of freedom 1
and denominator degrees of freedom 85.
Decision Rule: This test statistic corresponds to a p-value of 0.7152. We do
not have any evidence to reject the null hypothesis that there is main effect
of message on the average amount a server gets tipped.
_____________________________________________________________
H0: No main effect of gender
Ha: A main effect of gender exists
Test Statistic: F0 = 2602/109.8 = 23.7 with numerator df = 1 and
denominator df = 85.
Decision Rule: This test statistic corresponds to a p-value of less than .0001.
We have very strong evidence that a main effect of gender does exist.
_____________________________________________________________
H0: No interaction effect between gender and message
Ha: An interaction effect between gender and message exists.
Test Statistic: F0 = 438.7/109.8 = 4.0 with numerator df = 1 and
denominator df = 85.
Decision Rule: This test statistic corresponds to a p-value of .0487. We
have evidence to reject the null hypothesis of no interaction at the α = 0.05
level. We have reason to believe that there is an interaction effect.
_____________________________________________________________
13

More Related Content

PDF
Different types of distributions
PDF
Spearman Rank Correlation - Thiyagu
PPTX
Anova, ancova
PPTX
Two way analysis of variance (anova)
PPTX
Confidence interval
PDF
Chi-square distribution
PPTX
Wilcoxon signed rank test
Different types of distributions
Spearman Rank Correlation - Thiyagu
Anova, ancova
Two way analysis of variance (anova)
Confidence interval
Chi-square distribution
Wilcoxon signed rank test

What's hot (20)

PPT
Spearman Rank Correlation Presentation
PDF
Frequency Distributions
PDF
Diagnostic in poisson regression models
PPTX
Friedman test Stat
PPTX
F test and ANOVA
PDF
Introduction to ANOVA
PPTX
What is a partial correlation?
PPTX
Regression analysis: Simple Linear Regression Multiple Linear Regression
PPTX
Measures of dispersion
PPTX
Goodness of fit (ppt)
PPT
T test statistics
PPTX
poisson distribution
PPTX
Anova in easyest way
PPTX
Regression
PPT
Probability distribution
PPTX
Friedman Test- A Presentation
PPTX
Anova; analysis of variance
PDF
Probability Distributions
PPTX
Regression ppt
PPT
Introduction to ANOVAs
Spearman Rank Correlation Presentation
Frequency Distributions
Diagnostic in poisson regression models
Friedman test Stat
F test and ANOVA
Introduction to ANOVA
What is a partial correlation?
Regression analysis: Simple Linear Regression Multiple Linear Regression
Measures of dispersion
Goodness of fit (ppt)
T test statistics
poisson distribution
Anova in easyest way
Regression
Probability distribution
Friedman Test- A Presentation
Anova; analysis of variance
Probability Distributions
Regression ppt
Introduction to ANOVAs
Ad

Similar to 2 way ANOVA(Analysis Of VAriance (20)

PPTX
Analysis of variance (anova)
DOCX
Inferential AnalysisChapter 20NUR 6812Nursing Research
PPTX
ANOVA - BI FACTORIAL ANOVA (2- WAY ANOVA)
ODP
ANOVA II
PPTX
ANOVA biostat easy explaination .pptx
PPT
classmar16.ppt
PPT
classmar16.ppt
PPTX
Hypothesis Testing
PPT
Advance statistics 2
PPTX
ANOVA.pptx
PDF
How do I do a T test, correlation and ANOVA in SpssSolution .pdf
PPTX
Analysis of Variance
PPT
One Way Anova
PPTX
Anova test
PPTX
Analysis of variance (ANOVA)
PPTX
PPTX
_ Multivariable Abnalysisnnnnnnnnnn.pptx
PPTX
Parametric test - t Test, ANOVA, ANCOVA, MANOVA
Analysis of variance (anova)
Inferential AnalysisChapter 20NUR 6812Nursing Research
ANOVA - BI FACTORIAL ANOVA (2- WAY ANOVA)
ANOVA II
ANOVA biostat easy explaination .pptx
classmar16.ppt
classmar16.ppt
Hypothesis Testing
Advance statistics 2
ANOVA.pptx
How do I do a T test, correlation and ANOVA in SpssSolution .pdf
Analysis of Variance
One Way Anova
Anova test
Analysis of variance (ANOVA)
_ Multivariable Abnalysisnnnnnnnnnn.pptx
Parametric test - t Test, ANOVA, ANCOVA, MANOVA
Ad

More from musadoto (20)

PDF
The design of Farm cart 0011 report 1 2020
PDF
IRRIGATION SYSTEMS AND DESIGN - IWRE 317 questions collection 1997 - 2018 ...
PDF
CONSTRUCTION [soil treatment, foundation backfill, Damp Proof Membrane[DPM] a...
PDF
Assignment thermal 2018 . ...
PDF
BASICS OF COMPUTER PROGRAMMING-TAKE HOME ASSIGNMENT 2018
PDF
ENGINEERING SYSTEM DYNAMICS-TAKE HOME ASSIGNMENT 2018
PDF
Hardeninig of steel (Jominy test)-CoET- udsm
PDF
Ultrasonic testing report-JUNE 2018
PDF
Ae 219 - BASICS OF PASCHAL PROGRAMMING-2017 test manual solution
DOCX
Fluid mechanics ...
PDF
Fluid mechanics (a letter to a friend) part 1 ...
PDF
Fluids mechanics (a letter to a friend) part 1 ...
PPTX
Fresh concrete -building materials for engineers
PPT
surveying- lecture notes for engineers
PDF
Fresh concrete -building materials for engineers
DOCX
DIESEL ENGINE POWER REPORT -AE 215 -SOURCES OF FARM POWER
PDF
Farm and human power REPORT - AE 215-SOURCES OF FARM POWER
PDF
ENGINE POWER PETROL REPORT-AE 215-SOURCES OF FARM POWER
PDF
TRACTOR POWER REPORT -AE 215 SOURCES OF FARM POWER 2018
PDF
WIND ENERGY REPORT AE 215- 2018 SOURCES OF FARM POWER
The design of Farm cart 0011 report 1 2020
IRRIGATION SYSTEMS AND DESIGN - IWRE 317 questions collection 1997 - 2018 ...
CONSTRUCTION [soil treatment, foundation backfill, Damp Proof Membrane[DPM] a...
Assignment thermal 2018 . ...
BASICS OF COMPUTER PROGRAMMING-TAKE HOME ASSIGNMENT 2018
ENGINEERING SYSTEM DYNAMICS-TAKE HOME ASSIGNMENT 2018
Hardeninig of steel (Jominy test)-CoET- udsm
Ultrasonic testing report-JUNE 2018
Ae 219 - BASICS OF PASCHAL PROGRAMMING-2017 test manual solution
Fluid mechanics ...
Fluid mechanics (a letter to a friend) part 1 ...
Fluids mechanics (a letter to a friend) part 1 ...
Fresh concrete -building materials for engineers
surveying- lecture notes for engineers
Fresh concrete -building materials for engineers
DIESEL ENGINE POWER REPORT -AE 215 -SOURCES OF FARM POWER
Farm and human power REPORT - AE 215-SOURCES OF FARM POWER
ENGINE POWER PETROL REPORT-AE 215-SOURCES OF FARM POWER
TRACTOR POWER REPORT -AE 215 SOURCES OF FARM POWER 2018
WIND ENERGY REPORT AE 215- 2018 SOURCES OF FARM POWER

Recently uploaded (20)

PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
Pre independence Education in Inndia.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Business Ethics Teaching Materials for college
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
Renaissance Architecture: A Journey from Faith to Humanism
Week 4 Term 3 Study Techniques revisited.pptx
Pre independence Education in Inndia.pdf
Cell Types and Its function , kingdom of life
Abdominal Access Techniques with Prof. Dr. R K Mishra
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPH.pptx obstetrics and gynecology in nursing
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
102 student loan defaulters named and shamed – Is someone you know on the list?
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Business Ethics Teaching Materials for college
Microbial diseases, their pathogenesis and prophylaxis
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025

2 way ANOVA(Analysis Of VAriance

  • 1. www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA CHAPTER 13 – TWO-WAY ANALYSIS OF VARIANCE Two-way ANOVA has many of the same ideas as one-way ANOVA, with the main difference being the inclusion of another factor (or explanatory variable) in our model. In the two-way ANOVA model, there are two factors, each with its own number of levels. When we are interested in the effects of two factors, it is much more advantageous to perform a two-way analysis of variance, as opposed to two separate one-way ANOVAs. There are three main advantages of two-way ANOVA: - It is more efficient to study two factors simultaneously rather than separately. - We can reduce the residual variation in a model by including a second factor thought to influence the response. - We can investigate interactions between factors. The interaction between two variables is usually the most interesting feature of a two-way analysis of variance. When two factors interact, the effect on the response variable of one explanatory variable depends on the specific value or level of the other explanatory variable. For example, the statement “being overweight caused greater increases in blood pressure for men than for women” is a statement describing interaction. The effect of weight (factor #1, categorical – overweight or not overweight) on blood pressure (response) depends on gender (factor #2, categorical – male or female). The term main effect is used to describe the overall effect of a single explanatory variable. For our previous example, there would be two main effects: the effect of weight on blood pressure and the effect of gender on blood pressure. 1
  • 2. www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA The presence of a main effect might not necessarily be useful when an interaction effect exists. For example, it might be sensible to report the effect of being overweight on blood pressure without reporting that there is a difference in the effect of being overweight on blood pressure for men and women. There are many types of interactions which can often be seen from patterns in graphs. We will study some types in the following examples. Example #1(a) The Bureau of Labor Statistics collects data on earnings of workers in the US classified according to various characteristics. Here are the mean weekly earnings in dollars of men and women in two age groups who were working full-time in the first quarter of 1997: Age Women Men Mean 16-19 20-24 239 302 264 333 251.5 317.5 Mean 270.5 298.5 284.5 Figure 13.1 is a plot of the group means. It clearly shows an existence of main effects. From the plot we can see that on average men earn more than women indicating an effect of gender. We can also see an effect of age since the older groups makes on average more than the younger age group. What about the interaction between gender and age? An interaction is present when the main effects cannot provide a complete description of the data. Figure 13.1 2
  • 3. www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA In our graph, the only two effects that are present are an effect due to age and an effect due to gender. We know that men make, on average, more than women, but there is no dependence on age to determine the amount that men make more than women. Therefore, since there is no dependence between gender and age, there is no interaction effect. Parallel lines in our plot usually imply little or no interaction. Example #1 (b) The survey described in 1(a) also gave weekly earnings for groups of older workers. Here is the complete table: Figure 13.2 Age Women Men Mean 16-19 20-24 25-34 35-44 45-54 55-64 239 302 422 475 496 426 264 333 514 639 692 660 251.5 317.5 468.0 557.0 594.0 543.0 Mean 393 517 455.0 Figure 13.2 is a plot of the group means. It demonstrates both main effects and an interaction between gender and age. In this case, the main effects do not provide a complete description of the data since now the gender difference in earnings depends on which age group we examine. As the age of the workers increases, the earnings increase (except in the last age group). We also see a main effect of gender on earnings. However, our interaction shows that the amount by which the men earn over the women depends on the age group. Therefore, there is a very strong interaction present and our main effects don’t provide us with enough information to get an accurate idea of the relationship between age and earnings as well as gender and earnings. 3
  • 4. www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA Example #2 A study of the energy expenditure of farmers in Burkina Faso collected data during the wet and dry seasons. The farmers grow millet during the wet season. In the dry season there is very little activity because the ground is too hard to grow crops. The mean energy expended (in calories) by men and women in Burkina Faso during the wet and dry seasons is given in the following table: Season Men Women Mean Dry Wet 2310 3460 2320 2890 2315 3175 Mean 2885 2605 2745 During the dry season both men and women use about the same amount of energy. However, during the wet season, both genders burn more calories. Therefore, there is an effect of season on the number of calories burned. During the wet season, since it is the custom for men to do most of the field work, they use more energy on average than women. Therefore, there is an effect of gender on the number of calories burned, but only in the wet season. So there is an interaction between gender and season, as well as main effects of both factors. Figure 13.3 4
  • 5. www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA THE TWO-WAY ANOVA MODEL When discussing two-way ANOVA models, we will use the labels A and B to represent our two factors. In examples, we will use the factor names so that we can easily see the meaning of each variable. We use I to represent the number of levels of factor A and J to represent the number of levels of factor B. Therefore, we call the general two-way problem an I x J ANOVA, since every level of A is combined with every level of B, so that I x J groups are compared. The sample size for level i of factor A and level j of factor B is nij. The total number of observations is N = Σ nij. Example #3 A company wants to compare three different training programs for its new employees. Each of these programs takes 8 hours to complete. The training can be given for 8 hours on one day or for 4 hours on two consecutive days. The next 120 employees that the company hires will be the subjects for this study. After the training is completed, the employees are asked to evaluate the effectiveness of the program on a 7-point scale. Identify the response and explanatory variables, state the number of levels for each factor (I and J) and the total number of observations (N). 5
  • 6. www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA Solution: Explanatory variables: 1) Training program (I = 3 levels) 2) The manner in which the employee does the training (J = 2 levels: 8 hrs f or one day, 4 hrs on two consecutive days). Response variable: the 7-point scaled effectiveness score Total number of observations N = 120 _____________________________________________________________ For our two-way ANOVA, we assume to have independent SRSs of size nij from each of I x J normal populations. The population means µij may differ, but all populations must have the same standard deviation σ. Let xijk be the kth observation from the population having factor A at level i and factor B at level j. Since our observations differ from their mean by a value of εijk (xijk – µij = εijk), we can write our two-way ANOVA model in the form: xijk = µij + εijk. In this case, i = 1,2, …, I, j = 1,2,…, J, k = 1,2,…,nij and the deviations εijk are normally distributed with mean 0 and standard deviation σ. As in the previous chapters, we can describe our model by DATA = FIT + RESIDUAL. In this case, the fit part of our model is the means µij, (since we use each mean to describe each population) and the residual part is the deviations εijk of the individual observations from their group means. Our population means µij and the population standard deviations are all unknown. Therefore, we pick simple random samples (SRSs) to learn about the relationship between our factors and the response in our samples and then use that to estimate the relationship in our population. 6
  • 7. www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA PARAMETER ESTIMATES The population mean for the group with level i of factor A and level j of factor B is represented by µij. It can be estimated by 1 1 ijn ij ijk ij k x x n = = ∑ . Since every σ (population standard deviation) is assumed to be the same in two-way ANOVA, we can pool all of our estimates (sample standard deviations) to give one estimate of the population standard deviation. 2 2 ( 1) ( 1) ij ij p ij n s s n − = − ∑ ∑ and 2 p ps s= Just like in one-way ANOVA, sp 2 = MSE, and so the numerator of sp 2 is equal to SSE and the denominator is equal to DFE (since we have ( 1ijn )−∑ = N - IJ, so we have N observations being compared to IJ sample means). 7
  • 8. www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA Example #4 Students in a statistics class gave information on their height and weight and also reported their perception of their weight (about right, underweight, overweight). The body mass index, BMI, was calculated for each combination of student gender and perception of weight category (BMI = Weight/Height). Calculate each sample mean based on the data. Perception of Weight Underweight About Right Overweight Female 20.2 20.6 18.1 21.4 22.5 23.1 20.9 24.5 26.0 22.7 24.6 Male 23.8 20.5 23.4 26.5 22.2 24.0 28.1 26.4 27.7 Solution: Let factor A be the perception of weight and let factor B be gender. Within factor A, let level 1 be underweight, level 2 be about right, and level 3 be overweight. Within factor B (gender), let level 1 be female and let level 2 be male. So µ11 corresponds to the population mean BMI of underweight females, µ12 corresponds to the population mean BMI of underweight males, and so on. So to estimate these population values, we use xij(bar) to estimate µij for i=1,2,3 and j=1,2. Now, x11(bar) = (20.2 + 20.6 + 18.1 + 21.4) / 4 = 20.075 x12(bar) = (23.8 + 20.5) / 2 = 22.15 x21(bar) = (22.5 + 23.1 + 20.9) / 3 = 21.167 x22(bar) = (23.4 + 26.5 + 22.2 + 24.0) / 4 = 24.025 x31(bar) = (24.5 + 26 + 22.7 + 24.6) / 4 = 24.45 x32(bar) = (28.1 + 26.4 + 27.7) / 3 = 27.4 Note: (bar) just means that the x has a bar over it (indicating a mean). 8
  • 9. www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA TWO-WAY ANOVA TABLE In two-way ANOVA, there are three F statistics that are calculated and used in significance tests: two that test for the main effects and one that tests for an interaction. Therefore, the sum of squares for our FIT (SSM) is made up of three parts: SSA - sum of squares for factor A SSB - sum of squares for factor B SSAB - sum of squares for the interaction between factor A and factor B Our total sum of squares and total degrees of freedom are still the sum of the sources of variation and degrees of freedom in our model. SST = SSA + SSB + SSAB + SSE DFT = DFA + DFB + DFAB + DFE When our sample sizes are different, do not be alarmed if our sums of squares do not add up to our given SST. When our sample sizes are different, this can cause sums of squares which don’t add. Since we have I levels of factor A, DFA = I – 1. Since we have J levels of factor B, DFB = J – 1. Since SSM = SSA + SSB + SSAB and DFM = IJ – 1, DFAB = (IJ – 1) – (I – 1) – (J – 1) = (I – 1)( J – 1). DFE = N – IJ (we have N observations and IJ sample means) DFT = N – 1 9
  • 10. www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA TWO-WAY ANOVA TABLE Source Degrees of Freedom Sums of Squares Mean Square F A I – 1 SSA SSA/DFA MSA/MSE B J – 1 SSB SSB/DFB MSB/MSE AB (I – 1)(J – 1) SSAB SSAB/DFAB MSAB/MSE Error N – IJ SSE SSE/DFE Total N - 1 SST Remember that when we do a two-way ANOVA, we need to assume that our data is normally distributed and that the population standard deviations are equal. Therefore, we must make sure that twice our smallest sample standard deviation is larger than our largest standard deviation. 10
  • 11. www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA HYPOTHESES FOR TWO-WAY ANOVA To test the main effect of A: H0: No main effect of A Ha: There exists a main effect of factor A F = MSA Compare to F(I-1, N-IJ) MSE To test the main effect of B: H0: No main effect of B Ha: There exists a main effect of factor B F = MSB Compare to F(J-1, N-IJ) MSE To test the interaction of A and B: H0: No interaction Ha: There exists an interaction between factor A and factor B F = MSAB Compare to F((I-1)(J-1), N-IJ) MSE 11
  • 12. www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA Example #5 When a restaurant server writes a friendly note or draws a “happy face” on your restaurant check, is this just a friendly act or is there a financial incentive? Psychologists conducted a randomized experiment to investigate whether drawing a happy face on the back of a restaurant bill increased the average tip given to the server. One female server and one male server in a Philadelphia restaurant either did or did not draw a happy face on checks during the experiment. In all they drew happy faces on 45 checks and did not draw happy faces on 44 checks. The sequence of drawing the happy faces or not was random. a) Identify the response and explanatory variables, state the number of levels for each factor (I and J) and the total number of observations (N). Solution: Response variable: tip Explanatory variables: gender of server (2 levels), message (2 levels, yes or no) Total number of observations: N = 89 b) Complete the following two-way ANOVA table and then perform the appropriate F tests for main effects and interaction and state your conclusions. Try to fill the table in on your own (answer is below): Source DF SS MS F Message 14.7 Gender 2602.0 Interaction 438.7 Error 109.8 Total 12407.9 12
  • 13. www.stat.ufl.edu/~ssaha/3024.html Ch 13 – Two Way ANOVA Solution: Source DF SS MS F Message 1 14.7 14.7 0.134 Gender 1 2602.0 2602.0 23.7 Interaction 1 438.7 438.7 4.0 Error 85 9333.0 109.8 Total 88 12407.9 --- H0: No main effect of message Ha: A main effect of message exists Test Statistic: F0 = 14.7/109.8 = 0.134 with numerator degrees of freedom 1 and denominator degrees of freedom 85. Decision Rule: This test statistic corresponds to a p-value of 0.7152. We do not have any evidence to reject the null hypothesis that there is main effect of message on the average amount a server gets tipped. _____________________________________________________________ H0: No main effect of gender Ha: A main effect of gender exists Test Statistic: F0 = 2602/109.8 = 23.7 with numerator df = 1 and denominator df = 85. Decision Rule: This test statistic corresponds to a p-value of less than .0001. We have very strong evidence that a main effect of gender does exist. _____________________________________________________________ H0: No interaction effect between gender and message Ha: An interaction effect between gender and message exists. Test Statistic: F0 = 438.7/109.8 = 4.0 with numerator df = 1 and denominator df = 85. Decision Rule: This test statistic corresponds to a p-value of .0487. We have evidence to reject the null hypothesis of no interaction at the α = 0.05 level. We have reason to believe that there is an interaction effect. _____________________________________________________________ 13