SlideShare a Scribd company logo
1 of 30
ANOVA:
Analysis of Variation
Math 143 Lecture
R. Pruim
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?
If categorical variable has only 2 values:
• 2-sample t-test
ANOVA allows for 3 or more groups
An example ANOVA situation
Subjects: 25 patients with blisters
Treatments: Treatment A, Treatment B, Placebo
Measurement: # of days until blisters heal
Data [and means]:
• A: 5,6,6,7,7,8,9,10 [7.25]
• B: 7,7,8,9,9,10,10,11 [8.875]
• P: 7,9,9,10,10,10,11,12,13 [10.11]
Are these differences significant?
Informal Investigation
Graphical investigation:
• side-by-side box plots
• multiple histograms
Whether the differences between the groups are
significant depends on
• the difference in the means
• the standard deviations of each group
• the sample sizes
ANOVA determines P-value from the F statistic
Side by Side Boxplots
P
B
A
13
12
11
10
9
8
7
6
5
treatment
days
What does ANOVA do?
At its simplest (there are extensions) ANOVA
tests the following hypotheses:
H0: The means of all the groups are equal.
Ha: Not all the means are equal
• doesn’t say how or which ones differ.
• Can follow up with “multiple comparisons”
Note: we usually refer to the sub-populations as
“groups” when doing ANOVA.
Assumptions of ANOVA
• each group is approximately normal
check this by looking at histograms and/or
normal quantile plots, or use assumptions
 can handle some nonnormality, but not
severe outliers
• standard deviations of each group are
approximately equal
 rule of thumb: ratio of largest to smallest
sample st. dev. must be less than 2:1
Normality Check
We should check for normality using:
• assumptions about population
• histograms for each group
• normal quantile plot for each group
With such small data sets, there really isn’t a
really good way to check normality from data,
but we make the common assumption that
physical measurements of people tend to be
normally distributed.
Standard Deviation Check
Compare largest and smallest standard deviations:
• largest: 1.764
• smallest: 1.458
• 1.458 x 2 = 2.916 > 1.764
Note: variance ratio of 4:1 is equivalent.
Variable treatment N Mean Median StDev
days A 8 7.250 7.000 1.669
B 8 8.875 9.000 1.458
P 9 10.111 10.000 1.764
Notation for ANOVA
• n = number of individuals all together
• I = number of groups
• = mean for entire data set is
Group i has
• ni = # of individuals in group i
• xij = value for individual j in group i
• = mean for group i
• si = standard deviation for group i
i
x
x
How ANOVA works (outline)
ANOVA measures two sources of variation in the data and
compares their relative sizes
• variation BETWEEN groups
• for each data value look at the difference between
its group mean and the overall mean
• variation WITHIN groups
• for each data value we look at the difference
between that value and the mean of its group
 2
i
ij x
x 
 2
x
xi 
The ANOVA F-statistic is a ratio of the
Between Group Variaton divided by the
Within Group Variation:
MSE
MSG
Within
Between
F 

A large F is evidence against H0, since it
indicates that there is more difference
between groups than within groups.
Minitab ANOVA Output
Analysis of Variance for days
Source DF SS MS F P
treatment 2 34.74 17.37 6.45 0.006
Error 22 59.26 2.69
Total 24 94.00
How are these computations
made?
We want to measure the amount of variation due
to BETWEEN group variation and WITHIN group
variation
For each data value, we calculate its contribution
to:
• BETWEEN group variation:
• WITHIN group variation:
 2
x
xi 
2
)
( i
ij x
x 
An even smaller example
Suppose we have three groups
• Group 1: 5.3, 6.0, 6.7
• Group 2: 5.5, 6.2, 6.4, 5.7
• Group 3: 7.5, 7.2, 7.9
We get the following statistics:
SUMMARY
Groups Count Sum Average Variance
Column1 3 18 6 0.49
Column2 4 23.8 5.95 0.176667
Column3 3 22.6 7.533333 0.123333
Excel ANOVA Output
ANOVA
Source of Variation SS df MS F P-value F crit
Between Groups 5.127333 2 2.563667 10.21575 0.008394 4.737416
Within Groups 1.756667 7 0.250952
Total 6.884 9
1 less than number
of groups
number of data values -
number of groups
(equals df for each
group added together)
1 less than number of individuals
(just like other situations)
Computing ANOVA F statistic
WITHIN BETWEEN
difference: difference
group data - group mean group mean - overall mean
data group mean plain squared plain squared
5.3 1 6.00 -0.70 0.490 -0.4 0.194
6.0 1 6.00 0.00 0.000 -0.4 0.194
6.7 1 6.00 0.70 0.490 -0.4 0.194
5.5 2 5.95 -0.45 0.203 -0.5 0.240
6.2 2 5.95 0.25 0.063 -0.5 0.240
6.4 2 5.95 0.45 0.203 -0.5 0.240
5.7 2 5.95 -0.25 0.063 -0.5 0.240
7.5 3 7.53 -0.03 0.001 1.1 1.188
7.2 3 7.53 -0.33 0.109 1.1 1.188
7.9 3 7.53 0.37 0.137 1.1 1.188
TOTAL 1.757 5.106
TOTAL/df 0.25095714 2.55275
overall mean: 6.44 F = 2.5528/0.25025 = 10.21575
Minitab ANOVA Output
1 less than # of
groups
# of data values - # of groups
(equals df for each group
added together)
1 less than # of individuals
(just like other situations)
Analysis of Variance for days
Source DF SS MS F P
treatment 2 34.74 17.37 6.45 0.006
Error 22 59.26 2.69
Total 24 94.00
Minitab ANOVA Output
Analysis of Variance for days
Source DF SS MS F P
treatment 2 34.74 17.37 6.45 0.006
Error 22 59.26 2.69
Total 24 94.00
2
)
( i
obs
ij x
x 
 2
)
( x
x
obs
i 

2
)
( x
x
obs
ij 

SS stands for sum of squares
• ANOVA splits this into 3 parts
Minitab ANOVA Output
MSG = SSG / DFG
MSE = SSE / DFE
Analysis of Variance for days
Source DF SS MS F P
treatment 2 34.74 17.37 6.45 0.006
Error 22 59.26 2.69
Total 24 94.00
F = MSG / MSE
P-value
comes from
F(DFG,DFE)
(P-values for the F statistic are in Table E)
So How big is F?
Since F is
Mean Square Between / Mean Square Within
= MSG / MSE
A large value of F indicates relatively more
difference between groups than within groups
(evidence against H0)
To get the P-value, we compare to F(I-1,n-I)-distribution
• I-1 degrees of freedom in numerator (# groups -1)
• n - I degrees of freedom in denominator (rest of df)
Connections between SST, MST, and
standard deviation
So SST = (n -1) s2, and MST = s2. That is, SST
and MST measure the TOTAL variation in the
data set.
  MST
DFT
SST
n
x
x
s ij






1
2
2
If ignore the groups for a moment and just
compute the standard deviation of the entire
data set, we see
Connections between SSE, MSE,
and standard deviation
So SS[Within Group i] = (si
2) (dfi )
 
i
i
i
ij
i
df
i
SS
n
x
x
s
]
Group
Within
[
1
2
2





This means that we can compute SSE from the
standard deviations and sizes (df) of each group:
)
(
)
1
(
]
[
]
[
2
2
i
i
i
i df
s
n
s
i
Group
Within
SS
Within
SS
SSE








Remember:
Pooled estimate for st. dev
I
n
s
n
s
n
s
n
s I
I
p








2
2
2
2
2
1
1
2 )
1
(
)
1
(
)
1
( 
I
I
I
p
df
df
df
s
df
s
df
s
df
s









2
1
2
2
2
2
2
1
1
2 )
(
)
(
)
(
One of the ANOVA assumptions is that all
groups have the same standard deviation. We
can estimate this with a weighted average:
MSE
DFE
SSE
sp 

2
so MSE is the
pooled estimate
of variance
In Summary
MSE
MSG
F
DF
SS
MS
SST
SSG
SSE
x
x
n
x
x
SSG
df
s
x
x
SSE
DFT
s
x
x
SST
groups
i
i
obs
i
i
groups
i
obs
i
ij
obs
ij



















;
;
)
(
)
(
)
(
)
(
)
(
)
(
2
2
2
2
2
2
R2 Statistic
SST
SSG
Total
SS
Between
SS
R 

]
[
]
[
2
R2 gives the percent of variance due to between
group variation
This is very much like the R2 statistic that we
computed back when we did regression.
Where’s the Difference?
Analysis of Variance for days
Source DF SS MS F P
treatment 2 34.74 17.37 6.45 0.006
Error 22 59.26 2.69
Total 24 94.00
Individual 95% CIs For Mean
Based on Pooled StDev
Level N Mean StDev ----------+---------+---------+------
A 8 7.250 1.669 (-------*-------)
B 8 8.875 1.458 (-------*-------)
P 9 10.111 1.764 (------*-------)
----------+---------+---------+------
Pooled StDev = 1.641 7.5 9.0 10.5
Once ANOVA indicates that the groups do not all
appear to have the same means, what do we do?
Clearest difference: P is worse than A (CI’s don’t overlap)
Multiple Comparisons
Once ANOVA indicates that the groups do not all
have the same means, we can compare them two
by two using the 2-sample t test
• We need to adjust our p-value threshold because we
are doing multiple tests with the same data.
•There are several methods for doing this.
• If we really just want to test the difference between one
pair of treatments, we should set the study up that way.
Tuckey’s Pairwise Comparisons
Tukey's pairwise comparisons
Family error rate = 0.0500
Individual error rate = 0.0199
Critical value = 3.55
Intervals for (column level mean) - (row level mean)
A B
B -3.685
0.435
P -4.863 -3.238
-0.859 0.766
95% confidence
Use alpha = 0.0199 for
each test.
These give 98.01%
CI’s for each pairwise
difference.
Only P vs A is significant
(both values have same sign)
95% CI for A-P is (-0.86,-4.86)
Fisher’s Pairwise Comparisons
Fisher's pairwise comparisons
Family error rate = 0.119
Individual error rate = 0.0500
Critical value = 2.074
Intervals for (column level mean) - (row level mean)
A B
B -3.327
0.077
P -4.515 -2.890
-1.207 0.418
Now we set the individual
error rate (alpha) and see
the overall error rate.
95% confidence on each
corresponds to 88.1%
confidence overall

More Related Content

Similar to ANOVAs01.ppt

Analysis of variance
Analysis of varianceAnalysis of variance
Analysis of varianceRavi Rohilla
 
Analysis of variance ppt @ bec doms
Analysis of variance ppt @ bec domsAnalysis of variance ppt @ bec doms
Analysis of variance ppt @ bec domsBabasab Patil
 
Anova n metaanalysis
Anova n metaanalysisAnova n metaanalysis
Anova n metaanalysisutpal sharma
 
2.0.statistical methods and determination of sample size
2.0.statistical methods and determination of sample size2.0.statistical methods and determination of sample size
2.0.statistical methods and determination of sample sizesalummkata1
 
ANOVA BIOstat short explaination .pptx
ANOVA BIOstat short explaination   .pptxANOVA BIOstat short explaination   .pptx
ANOVA BIOstat short explaination .pptxDrDeveshPandey1
 
One-Way ANOVA: Conceptual Foundations
One-Way ANOVA: Conceptual FoundationsOne-Way ANOVA: Conceptual Foundations
One-Way ANOVA: Conceptual Foundationssmackinnon
 
9. basic concepts_of_one_way_analysis_of_variance_(anova)
9. basic concepts_of_one_way_analysis_of_variance_(anova)9. basic concepts_of_one_way_analysis_of_variance_(anova)
9. basic concepts_of_one_way_analysis_of_variance_(anova)Irfan Hussain
 
Full Lecture Presentation on ANOVA
Full Lecture Presentation on ANOVAFull Lecture Presentation on ANOVA
Full Lecture Presentation on ANOVAStevegellKololi
 
Quality Engineering material
Quality Engineering materialQuality Engineering material
Quality Engineering materialTeluguSudhakar3
 
Anova by Hazilah Mohd Amin
Anova by Hazilah Mohd AminAnova by Hazilah Mohd Amin
Anova by Hazilah Mohd AminHazilahMohd
 
Chap15 analysis of variance
Chap15 analysis of varianceChap15 analysis of variance
Chap15 analysis of varianceJudianto Nugroho
 
Anova lecture
Anova lectureAnova lecture
Anova lecturedoublem44
 

Similar to ANOVAs01.ppt (20)

Analysis of variance
Analysis of varianceAnalysis of variance
Analysis of variance
 
ANOVA.ppt
ANOVA.pptANOVA.ppt
ANOVA.ppt
 
Analysis of variance ppt @ bec doms
Analysis of variance ppt @ bec domsAnalysis of variance ppt @ bec doms
Analysis of variance ppt @ bec doms
 
Anova n metaanalysis
Anova n metaanalysisAnova n metaanalysis
Anova n metaanalysis
 
2.0.statistical methods and determination of sample size
2.0.statistical methods and determination of sample size2.0.statistical methods and determination of sample size
2.0.statistical methods and determination of sample size
 
ANOVA BIOstat short explaination .pptx
ANOVA BIOstat short explaination   .pptxANOVA BIOstat short explaination   .pptx
ANOVA BIOstat short explaination .pptx
 
Anova test
Anova testAnova test
Anova test
 
One-Way ANOVA: Conceptual Foundations
One-Way ANOVA: Conceptual FoundationsOne-Way ANOVA: Conceptual Foundations
One-Way ANOVA: Conceptual Foundations
 
9. basic concepts_of_one_way_analysis_of_variance_(anova)
9. basic concepts_of_one_way_analysis_of_variance_(anova)9. basic concepts_of_one_way_analysis_of_variance_(anova)
9. basic concepts_of_one_way_analysis_of_variance_(anova)
 
Full Lecture Presentation on ANOVA
Full Lecture Presentation on ANOVAFull Lecture Presentation on ANOVA
Full Lecture Presentation on ANOVA
 
ANOVA 2023 aa 2564896.pptx
ANOVA 2023  aa 2564896.pptxANOVA 2023  aa 2564896.pptx
ANOVA 2023 aa 2564896.pptx
 
Quality Engineering material
Quality Engineering materialQuality Engineering material
Quality Engineering material
 
One-Way ANOVA
One-Way ANOVAOne-Way ANOVA
One-Way ANOVA
 
ANOVA.pptx
ANOVA.pptxANOVA.pptx
ANOVA.pptx
 
lecture12.ppt
lecture12.pptlecture12.ppt
lecture12.ppt
 
lecture12.ppt
lecture12.pptlecture12.ppt
lecture12.ppt
 
oneway.ppt
oneway.pptoneway.ppt
oneway.ppt
 
Anova by Hazilah Mohd Amin
Anova by Hazilah Mohd AminAnova by Hazilah Mohd Amin
Anova by Hazilah Mohd Amin
 
Chap15 analysis of variance
Chap15 analysis of varianceChap15 analysis of variance
Chap15 analysis of variance
 
Anova lecture
Anova lectureAnova lecture
Anova lecture
 

Recently uploaded

What are the 4 characteristics of CTAs that convert?
What are the 4 characteristics of CTAs that convert?What are the 4 characteristics of CTAs that convert?
What are the 4 characteristics of CTAs that convert?Juan Pineda
 
Inbound Marekting 2.0 - The Paradigm Shift in Marketing | Axon Garside
Inbound Marekting 2.0 - The Paradigm Shift in Marketing | Axon GarsideInbound Marekting 2.0 - The Paradigm Shift in Marketing | Axon Garside
Inbound Marekting 2.0 - The Paradigm Shift in Marketing | Axon Garsiderobwhite630290
 
How To Utilize Calculated Properties in your HubSpot Setup
How To Utilize Calculated Properties in your HubSpot SetupHow To Utilize Calculated Properties in your HubSpot Setup
How To Utilize Calculated Properties in your HubSpot Setupssuser4571da
 
ASO Process: What is App Store Optimization
ASO Process: What is App Store OptimizationASO Process: What is App Store Optimization
ASO Process: What is App Store OptimizationAli Raza
 
The Skin Games 2024 25 - Sponsorship Deck
The Skin Games 2024 25 - Sponsorship DeckThe Skin Games 2024 25 - Sponsorship Deck
The Skin Games 2024 25 - Sponsorship DeckToluwanimi Balogun
 
SORA AI: Will It Be the Future of Video Creation?
SORA AI: Will It Be the Future of Video Creation?SORA AI: Will It Be the Future of Video Creation?
SORA AI: Will It Be the Future of Video Creation?Searchable Design
 
pptx.marketing strategy of tanishq. pptx
pptx.marketing strategy of tanishq. pptxpptx.marketing strategy of tanishq. pptx
pptx.marketing strategy of tanishq. pptxarsathsahil
 
McDonald's: A Journey Through Time (PPT)
McDonald's: A Journey Through Time (PPT)McDonald's: A Journey Through Time (PPT)
McDonald's: A Journey Through Time (PPT)DEVARAJV16
 
Digital Marketing Spotlight: Lifecycle Advertising Strategies.pdf
Digital Marketing Spotlight: Lifecycle Advertising Strategies.pdfDigital Marketing Spotlight: Lifecycle Advertising Strategies.pdf
Digital Marketing Spotlight: Lifecycle Advertising Strategies.pdfDemandbase
 
Red bull marketing presentation pptxxxxx
Red bull marketing presentation pptxxxxxRed bull marketing presentation pptxxxxx
Red bull marketing presentation pptxxxxx216310017
 
Content Marketing For A Travel Website On The Examples Of: Booking.com; TripA...
Content Marketing For A Travel Website On The Examples Of: Booking.com; TripA...Content Marketing For A Travel Website On The Examples Of: Booking.com; TripA...
Content Marketing For A Travel Website On The Examples Of: Booking.com; TripA...robertpresz7
 
Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...
Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...
Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...Search Engine Journal
 
How videos can elevate your Google rankings and improve your EEAT - Benjamin ...
How videos can elevate your Google rankings and improve your EEAT - Benjamin ...How videos can elevate your Google rankings and improve your EEAT - Benjamin ...
How videos can elevate your Google rankings and improve your EEAT - Benjamin ...Benjamin Szturmaj
 
定制(ULV毕业证书)拉文大学毕业证成绩单原版一比一
定制(ULV毕业证书)拉文大学毕业证成绩单原版一比一定制(ULV毕业证书)拉文大学毕业证成绩单原版一比一
定制(ULV毕业证书)拉文大学毕业证成绩单原版一比一s SS
 
Influencer Marketing Power point presentation
Influencer Marketing  Power point presentationInfluencer Marketing  Power point presentation
Influencer Marketing Power point presentationdgtivemarketingagenc
 
marketing strategy of tanishq word PPROJECT.pdf
marketing strategy of tanishq word PPROJECT.pdfmarketing strategy of tanishq word PPROJECT.pdf
marketing strategy of tanishq word PPROJECT.pdfarsathsahil
 
Forecast of Content Marketing through AI
Forecast of Content Marketing through AIForecast of Content Marketing through AI
Forecast of Content Marketing through AIRinky
 
Mastering SEO in the Evolving AI-driven World
Mastering SEO in the Evolving AI-driven WorldMastering SEO in the Evolving AI-driven World
Mastering SEO in the Evolving AI-driven WorldScalenut
 
Omnichannel Marketing: Defining Omnichannel Marketing
Omnichannel Marketing: Defining Omnichannel MarketingOmnichannel Marketing: Defining Omnichannel Marketing
Omnichannel Marketing: Defining Omnichannel MarketingDove Soft Ltd
 
The Pitfalls of Keyword Stuffing in SEO Copywriting
The Pitfalls of Keyword Stuffing in SEO CopywritingThe Pitfalls of Keyword Stuffing in SEO Copywriting
The Pitfalls of Keyword Stuffing in SEO CopywritingJuan Pineda
 

Recently uploaded (20)

What are the 4 characteristics of CTAs that convert?
What are the 4 characteristics of CTAs that convert?What are the 4 characteristics of CTAs that convert?
What are the 4 characteristics of CTAs that convert?
 
Inbound Marekting 2.0 - The Paradigm Shift in Marketing | Axon Garside
Inbound Marekting 2.0 - The Paradigm Shift in Marketing | Axon GarsideInbound Marekting 2.0 - The Paradigm Shift in Marketing | Axon Garside
Inbound Marekting 2.0 - The Paradigm Shift in Marketing | Axon Garside
 
How To Utilize Calculated Properties in your HubSpot Setup
How To Utilize Calculated Properties in your HubSpot SetupHow To Utilize Calculated Properties in your HubSpot Setup
How To Utilize Calculated Properties in your HubSpot Setup
 
ASO Process: What is App Store Optimization
ASO Process: What is App Store OptimizationASO Process: What is App Store Optimization
ASO Process: What is App Store Optimization
 
The Skin Games 2024 25 - Sponsorship Deck
The Skin Games 2024 25 - Sponsorship DeckThe Skin Games 2024 25 - Sponsorship Deck
The Skin Games 2024 25 - Sponsorship Deck
 
SORA AI: Will It Be the Future of Video Creation?
SORA AI: Will It Be the Future of Video Creation?SORA AI: Will It Be the Future of Video Creation?
SORA AI: Will It Be the Future of Video Creation?
 
pptx.marketing strategy of tanishq. pptx
pptx.marketing strategy of tanishq. pptxpptx.marketing strategy of tanishq. pptx
pptx.marketing strategy of tanishq. pptx
 
McDonald's: A Journey Through Time (PPT)
McDonald's: A Journey Through Time (PPT)McDonald's: A Journey Through Time (PPT)
McDonald's: A Journey Through Time (PPT)
 
Digital Marketing Spotlight: Lifecycle Advertising Strategies.pdf
Digital Marketing Spotlight: Lifecycle Advertising Strategies.pdfDigital Marketing Spotlight: Lifecycle Advertising Strategies.pdf
Digital Marketing Spotlight: Lifecycle Advertising Strategies.pdf
 
Red bull marketing presentation pptxxxxx
Red bull marketing presentation pptxxxxxRed bull marketing presentation pptxxxxx
Red bull marketing presentation pptxxxxx
 
Content Marketing For A Travel Website On The Examples Of: Booking.com; TripA...
Content Marketing For A Travel Website On The Examples Of: Booking.com; TripA...Content Marketing For A Travel Website On The Examples Of: Booking.com; TripA...
Content Marketing For A Travel Website On The Examples Of: Booking.com; TripA...
 
Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...
Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...
Do More with Less: Navigating Customer Acquisition Challenges for Today's Ent...
 
How videos can elevate your Google rankings and improve your EEAT - Benjamin ...
How videos can elevate your Google rankings and improve your EEAT - Benjamin ...How videos can elevate your Google rankings and improve your EEAT - Benjamin ...
How videos can elevate your Google rankings and improve your EEAT - Benjamin ...
 
定制(ULV毕业证书)拉文大学毕业证成绩单原版一比一
定制(ULV毕业证书)拉文大学毕业证成绩单原版一比一定制(ULV毕业证书)拉文大学毕业证成绩单原版一比一
定制(ULV毕业证书)拉文大学毕业证成绩单原版一比一
 
Influencer Marketing Power point presentation
Influencer Marketing  Power point presentationInfluencer Marketing  Power point presentation
Influencer Marketing Power point presentation
 
marketing strategy of tanishq word PPROJECT.pdf
marketing strategy of tanishq word PPROJECT.pdfmarketing strategy of tanishq word PPROJECT.pdf
marketing strategy of tanishq word PPROJECT.pdf
 
Forecast of Content Marketing through AI
Forecast of Content Marketing through AIForecast of Content Marketing through AI
Forecast of Content Marketing through AI
 
Mastering SEO in the Evolving AI-driven World
Mastering SEO in the Evolving AI-driven WorldMastering SEO in the Evolving AI-driven World
Mastering SEO in the Evolving AI-driven World
 
Omnichannel Marketing: Defining Omnichannel Marketing
Omnichannel Marketing: Defining Omnichannel MarketingOmnichannel Marketing: Defining Omnichannel Marketing
Omnichannel Marketing: Defining Omnichannel Marketing
 
The Pitfalls of Keyword Stuffing in SEO Copywriting
The Pitfalls of Keyword Stuffing in SEO CopywritingThe Pitfalls of Keyword Stuffing in SEO Copywriting
The Pitfalls of Keyword Stuffing in SEO Copywriting
 

ANOVAs01.ppt

  • 1. ANOVA: Analysis of Variation Math 143 Lecture R. Pruim
  • 2. 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? If categorical variable has only 2 values: • 2-sample t-test ANOVA allows for 3 or more groups
  • 3. An example ANOVA situation Subjects: 25 patients with blisters Treatments: Treatment A, Treatment B, Placebo Measurement: # of days until blisters heal Data [and means]: • A: 5,6,6,7,7,8,9,10 [7.25] • B: 7,7,8,9,9,10,10,11 [8.875] • P: 7,9,9,10,10,10,11,12,13 [10.11] Are these differences significant?
  • 4. Informal Investigation Graphical investigation: • side-by-side box plots • multiple histograms Whether the differences between the groups are significant depends on • the difference in the means • the standard deviations of each group • the sample sizes ANOVA determines P-value from the F statistic
  • 5. Side by Side Boxplots P B A 13 12 11 10 9 8 7 6 5 treatment days
  • 6. What does ANOVA do? At its simplest (there are extensions) ANOVA tests the following hypotheses: H0: The means of all the groups are equal. Ha: Not all the means are equal • doesn’t say how or which ones differ. • Can follow up with “multiple comparisons” Note: we usually refer to the sub-populations as “groups” when doing ANOVA.
  • 7. Assumptions of ANOVA • each group is approximately normal check this by looking at histograms and/or normal quantile plots, or use assumptions  can handle some nonnormality, but not severe outliers • standard deviations of each group are approximately equal  rule of thumb: ratio of largest to smallest sample st. dev. must be less than 2:1
  • 8. Normality Check We should check for normality using: • assumptions about population • histograms for each group • normal quantile plot for each group With such small data sets, there really isn’t a really good way to check normality from data, but we make the common assumption that physical measurements of people tend to be normally distributed.
  • 9. Standard Deviation Check Compare largest and smallest standard deviations: • largest: 1.764 • smallest: 1.458 • 1.458 x 2 = 2.916 > 1.764 Note: variance ratio of 4:1 is equivalent. Variable treatment N Mean Median StDev days A 8 7.250 7.000 1.669 B 8 8.875 9.000 1.458 P 9 10.111 10.000 1.764
  • 10. Notation for ANOVA • n = number of individuals all together • I = number of groups • = mean for entire data set is Group i has • ni = # of individuals in group i • xij = value for individual j in group i • = mean for group i • si = standard deviation for group i i x x
  • 11. How ANOVA works (outline) ANOVA measures two sources of variation in the data and compares their relative sizes • variation BETWEEN groups • for each data value look at the difference between its group mean and the overall mean • variation WITHIN groups • for each data value we look at the difference between that value and the mean of its group  2 i ij x x   2 x xi 
  • 12. The ANOVA F-statistic is a ratio of the Between Group Variaton divided by the Within Group Variation: MSE MSG Within Between F   A large F is evidence against H0, since it indicates that there is more difference between groups than within groups.
  • 13. Minitab ANOVA Output Analysis of Variance for days Source DF SS MS F P treatment 2 34.74 17.37 6.45 0.006 Error 22 59.26 2.69 Total 24 94.00
  • 14. How are these computations made? We want to measure the amount of variation due to BETWEEN group variation and WITHIN group variation For each data value, we calculate its contribution to: • BETWEEN group variation: • WITHIN group variation:  2 x xi  2 ) ( i ij x x 
  • 15. An even smaller example Suppose we have three groups • Group 1: 5.3, 6.0, 6.7 • Group 2: 5.5, 6.2, 6.4, 5.7 • Group 3: 7.5, 7.2, 7.9 We get the following statistics: SUMMARY Groups Count Sum Average Variance Column1 3 18 6 0.49 Column2 4 23.8 5.95 0.176667 Column3 3 22.6 7.533333 0.123333
  • 16. Excel ANOVA Output ANOVA Source of Variation SS df MS F P-value F crit Between Groups 5.127333 2 2.563667 10.21575 0.008394 4.737416 Within Groups 1.756667 7 0.250952 Total 6.884 9 1 less than number of groups number of data values - number of groups (equals df for each group added together) 1 less than number of individuals (just like other situations)
  • 17. Computing ANOVA F statistic WITHIN BETWEEN difference: difference group data - group mean group mean - overall mean data group mean plain squared plain squared 5.3 1 6.00 -0.70 0.490 -0.4 0.194 6.0 1 6.00 0.00 0.000 -0.4 0.194 6.7 1 6.00 0.70 0.490 -0.4 0.194 5.5 2 5.95 -0.45 0.203 -0.5 0.240 6.2 2 5.95 0.25 0.063 -0.5 0.240 6.4 2 5.95 0.45 0.203 -0.5 0.240 5.7 2 5.95 -0.25 0.063 -0.5 0.240 7.5 3 7.53 -0.03 0.001 1.1 1.188 7.2 3 7.53 -0.33 0.109 1.1 1.188 7.9 3 7.53 0.37 0.137 1.1 1.188 TOTAL 1.757 5.106 TOTAL/df 0.25095714 2.55275 overall mean: 6.44 F = 2.5528/0.25025 = 10.21575
  • 18. Minitab ANOVA Output 1 less than # of groups # of data values - # of groups (equals df for each group added together) 1 less than # of individuals (just like other situations) Analysis of Variance for days Source DF SS MS F P treatment 2 34.74 17.37 6.45 0.006 Error 22 59.26 2.69 Total 24 94.00
  • 19. Minitab ANOVA Output Analysis of Variance for days Source DF SS MS F P treatment 2 34.74 17.37 6.45 0.006 Error 22 59.26 2.69 Total 24 94.00 2 ) ( i obs ij x x   2 ) ( x x obs i   2 ) ( x x obs ij   SS stands for sum of squares • ANOVA splits this into 3 parts
  • 20. Minitab ANOVA Output MSG = SSG / DFG MSE = SSE / DFE Analysis of Variance for days Source DF SS MS F P treatment 2 34.74 17.37 6.45 0.006 Error 22 59.26 2.69 Total 24 94.00 F = MSG / MSE P-value comes from F(DFG,DFE) (P-values for the F statistic are in Table E)
  • 21. So How big is F? Since F is Mean Square Between / Mean Square Within = MSG / MSE A large value of F indicates relatively more difference between groups than within groups (evidence against H0) To get the P-value, we compare to F(I-1,n-I)-distribution • I-1 degrees of freedom in numerator (# groups -1) • n - I degrees of freedom in denominator (rest of df)
  • 22. Connections between SST, MST, and standard deviation So SST = (n -1) s2, and MST = s2. That is, SST and MST measure the TOTAL variation in the data set.   MST DFT SST n x x s ij       1 2 2 If ignore the groups for a moment and just compute the standard deviation of the entire data set, we see
  • 23. Connections between SSE, MSE, and standard deviation So SS[Within Group i] = (si 2) (dfi )   i i i ij i df i SS n x x s ] Group Within [ 1 2 2      This means that we can compute SSE from the standard deviations and sizes (df) of each group: ) ( ) 1 ( ] [ ] [ 2 2 i i i i df s n s i Group Within SS Within SS SSE         Remember:
  • 24. Pooled estimate for st. dev I n s n s n s n s I I p         2 2 2 2 2 1 1 2 ) 1 ( ) 1 ( ) 1 (  I I I p df df df s df s df s df s          2 1 2 2 2 2 2 1 1 2 ) ( ) ( ) ( One of the ANOVA assumptions is that all groups have the same standard deviation. We can estimate this with a weighted average: MSE DFE SSE sp   2 so MSE is the pooled estimate of variance
  • 26. R2 Statistic SST SSG Total SS Between SS R   ] [ ] [ 2 R2 gives the percent of variance due to between group variation This is very much like the R2 statistic that we computed back when we did regression.
  • 27. Where’s the Difference? Analysis of Variance for days Source DF SS MS F P treatment 2 34.74 17.37 6.45 0.006 Error 22 59.26 2.69 Total 24 94.00 Individual 95% CIs For Mean Based on Pooled StDev Level N Mean StDev ----------+---------+---------+------ A 8 7.250 1.669 (-------*-------) B 8 8.875 1.458 (-------*-------) P 9 10.111 1.764 (------*-------) ----------+---------+---------+------ Pooled StDev = 1.641 7.5 9.0 10.5 Once ANOVA indicates that the groups do not all appear to have the same means, what do we do? Clearest difference: P is worse than A (CI’s don’t overlap)
  • 28. Multiple Comparisons Once ANOVA indicates that the groups do not all have the same means, we can compare them two by two using the 2-sample t test • We need to adjust our p-value threshold because we are doing multiple tests with the same data. •There are several methods for doing this. • If we really just want to test the difference between one pair of treatments, we should set the study up that way.
  • 29. Tuckey’s Pairwise Comparisons Tukey's pairwise comparisons Family error rate = 0.0500 Individual error rate = 0.0199 Critical value = 3.55 Intervals for (column level mean) - (row level mean) A B B -3.685 0.435 P -4.863 -3.238 -0.859 0.766 95% confidence Use alpha = 0.0199 for each test. These give 98.01% CI’s for each pairwise difference. Only P vs A is significant (both values have same sign) 95% CI for A-P is (-0.86,-4.86)
  • 30. Fisher’s Pairwise Comparisons Fisher's pairwise comparisons Family error rate = 0.119 Individual error rate = 0.0500 Critical value = 2.074 Intervals for (column level mean) - (row level mean) A B B -3.327 0.077 P -4.515 -2.890 -1.207 0.418 Now we set the individual error rate (alpha) and see the overall error rate. 95% confidence on each corresponds to 88.1% confidence overall