Professional Documents
Culture Documents
Anova
Anova
ANALYSIS OF VARIATION
Prof. Lhars M. Barsabal
The basic ANOVA situation
Two variables: 1 Categorical, 1 Quantitative
13
12
11
10
days
A B P
treatment
What does ANOVA do?
At its simplest (there are extensions) ANOVA tests the
following hypotheses:
Group i has
• ni = # of individuals in group i
• xij = value for individual j in group i
• xi = mean for group i
• si = standard deviation for group i
How ANOVA works (outline)
ANOVA measures two sources of variation in the data and
compares their relative sizes
x i x 2
x ij xi
2
The ANOVA F-statistic is a ratio of the
Between Group Variaton divided by the
Within Group Variation:
Between MSG
F
Within MSE
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
R ANOVA Output
Df Sum Sq Mean Sq F value Pr(>F)
treatment 2 34.7 17.4 6.45 0.0063 **
Residuals 22 59.3 2.7
How are these computations made?
to: 2
• BETWEEN group variation: x i x
SUMMARY
Groups Count Sum Average Variance
Column 1 3 18 6 0.49
Column 2 4 23.8 5.95 0.176667
Column 3 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
(x xi ) 2
(x x) 2
(x
ij
obs ij x) 2
obs
i
obs
= MSG / MSE
Remember: si
2
x ij xi
2
SS[ Within Group i ]
ni 1 dfi
So SS[Within Group i] = (si2) (dfi )
obs
SSE (x ij x i ) si (df i )
2 2
obs groups
SSG (x i x) 2
n (x i i x) 2
obs groups
SS MSG
SSE SSG SST; MS ; F
DF MSE
R2 Statistic
R2 gives the percent of variance due to between
group variation
SS[Between ] SSG
R
2
SS[Total ] SST
A B
These give 98.01%
B -3.685
0.435
CI’s for each pairwise
difference.
P -4.863 -3.238
-0.859 0.766 Only P vs A is significant
(both values have same sign)
98% CI for A-P is (-0.86,-4.86)
Tukey’s Method in R
Tukey multiple comparisons of means
95% family-wise confidence level
5
3
4
4
6
Females 5
3
1
2
2
Complete the following ANOVA table.
Source SS df MS F
Protein Level 20 1
Gender 45 1
Protein Level x
Gender 5 1
Within 36 16
Total