Analysis of Variance (ANOVA)
Statistics for the Social SciencesPsychology 340
Spring 2010
PSY 340Statistics for the
Social SciencesOutline (for week)
• Basics of ANOVA• Why• Computations• Post-hoc and planned comparisons• Power and effect size for ANOVA• Assumptions • SPSS
– 1 factor between groups ANOVA– Post-hoc and planned comparisons
PSY 340Statistics for the
Social SciencesOutline (for week)
• Basics of ANOVA• Why• Computations• Post-hoc and planned comparisons• Power and effect size for ANOVA• Assumptions • SPSS
– 1 factor between groups ANOVA– Post-hoc and planned comparisons
PSY 340Statistics for the
Social SciencesExample
• Effect of knowledge of prior behavior on jury decisions– Dependent variable: rate how innocent/guilty– Independent variable: 3 levels
• Criminal record• Clean record• No information (no mention of a record)
Compare the means of these three groupsClean recordJurors
Guilt Rating
Criminal record
No Information
Guilt Rating
Guilt Rating
XC
XB
XA
PSY 340Statistics for the
Social Sciences
Statistical analysis follows design
• The 1 factor between groups ANOVA:– More than two– Independent & One
score per subject– 1 independent
variable
PSY 340Statistics for the
Social Sciences Analysis of Variance
XB XAXC
Criminal record Clean record No information
10 5 4
7 1 6
5 3 9
10 7 3
8 4 3
XA =8.0
SSA =18.0
XB =4.0
SSB =20.0
XC =5.0
SSC =26.0
• More than two groups– Now we can’t just
compute a simple difference score since there are more than one difference
Generic test statistic
observed differencedifference expected by chance
PSY 340Statistics for the
Social Sciences Analysis of Variance
XB XAXC
Criminal record Clean record No information
10 5 4
7 1 6
5 3 9
10 7 3
8 4 3
XA =8.0 XB =4.0 XC =5.0
SSA =18.0 SSB =20.0 SSC =26.0
– Need a measure that describes several difference scores
– Variance• Variance is essentially
an average squared difference
Observed variance
Variance from chanceF-ratio =
• More than two groups
test statistic
Tip: Many different groupings so use subscripts to keep things straight
PSY 340Statistics for the
Social Sciences Testing Hypotheses with ANOVA
– Step 1: State your hypotheses• Hypothesis testing: a five step program
• Null hypothesis (H0)– All of the populations all have same mean
• Alternative hypotheses (HA)– Not all of the populations all have same mean– There are several alternative hypotheses– We will return to this issue later
H 0 :μA =μB =μC
PSY 340Statistics for the
Social Sciences Testing Hypotheses with ANOVA
– Step 2: Set your decision criteria– Step 3: Collect your data – Step 4: Compute your test statistics
• Compute your estimated variances• Compute your F-ratio• Compute your degrees of freedom (there are several)
– Step 5: Make a decision about your null hypothesis
• Hypothesis testing: a five step program– Step 1: State your hypotheses
– Additional tests• Reconciling our multiple alternative hypotheses
PSY 340Statistics for the
Social Sciences Step 4: Computing the F-ratio
• Analyzing the sources of variance– Describe the total variance in the dependent measure
• Why are these scores different?
XB XAXC
• Two sources of variability– Within groups– Between groups
PSY 340Statistics for the
Social Sciences Step 4: Computing the F-ratio
• Within-groups estimate of the population variance – Estimating population variance from variation from
within each sample• Not affected by whether the null hypothesis is true
XB XAXC
Different people within each group
give different ratings
PSY 340Statistics for the
Social Sciences
• Between-groups estimate of the population variance – Estimating population variance from variation between
the means of the samples• Is affected by whether the null hypothesis is true
Step 4: Computing the F-ratio
XB XAXC
There is an effectof the IV, so the
people in differentgroups give different
ratings
PSY 340Statistics for the
Social Sciences Partitioning the variance
Total variance
Stage 1
Between groups variance
Within groups variance
Note: we will start with SS, but willget to variance
PSY 340Statistics for the
Social Sciences Partitioning the variance
Total varianceCriminal record Clean record No information
10 5 4
7 1 6
5 3 9
10 7 3
8 4 3
GM =X∑
N=8515
=5.67
SSTotal = X −GM( )∑ 2= 10 −5.67( )2 + ...+ 3−5.67( )2 =107.33
• Basically forgetting about separate groups– Compute the
Grand Mean (GM)
– Compute squared deviations from the Grand Mean
dfTotal =N−1=15 −1=14
PSY 340Statistics for the
Social Sciences Partitioning the variance
Total varianceCriminal record Clean record No information
10 5 4
7 1 6
5 3 9
10 7 3
8 4 3
GM =X∑
N=8515
=5.67
SSTotal = X −GM( )∑ 2= 10 −5.67( )2 + ...+ 3−5.67( )2 =107.33
• Basically forgetting about separate groups– Compute the
Grand Mean (GM)
– Compute squared deviations from the Grand Mean
dfTotal =N−1=15 −1=14
Formula alert:
SSTotal = X∑ 2−
X∑( )2
N
= 102 + 72 + ...+ 32( ) −852
15= 107.33
PSY 340Statistics for the
Social Sciences Partitioning the variance
Total variance
Stage 1
Between groups variance
Within groups variance
SSTotal = X−GM( )∑ 2
dfTotal =N−1
PSY 340Statistics for the
Social Sciences Partitioning the variance
Within groups varianceCriminal record Clean record No information
10 5 4
7 1 6
5 3 9
10 7 3
8 4 3
SSWithin = SSeach group∑ =SSA + SSB + SSC =64
• Basically the variability in each group1. Add up of the SS
from all of the groups
dfWithin = dfeach group∑ =4 + 4 + 4 =12
XA =8.0 XB =4.0 XC =5.0
SSA =18.0 SSB =20.0 SSC =26.0
dfA =4 dfB =4 dfC =4
PSY 340Statistics for the
Social Sciences Partitioning the variance
Total variance
Stage 1
Between groups variance
Within groups variance
SSTotal = X−GM( )∑ 2
dfTotal =N−1
SSWithin = SSeach group∑dfWithin = dfeach group∑
PSY 340Statistics for the
Social Sciences Partitioning the variance
Between groups varianceCriminal record Clean record No information
10 5 4
7 1 6
5 3 9
10 7 3
8 4 3
SSBetween = n X −GM( )∑ 2
• Basically how much each group differs from the Grand Mean1. Subtract the GM
from each group mean
2. Square the diffs3. Weight by number
of scores
dfbetween =#groups−1=3−1=2
XA =8.0 XB =4.0 XC =5.0
SSA =18.0 SSB =20.0 SSC =26.0
=5 8 − 5.67( )2 + 5 4 − 5.67( )2 + 5 5 − 5.67( )2
=43.3
PSY 340Statistics for the
Social Sciences Partitioning the variance
Between groups varianceCriminal record Clean record No information
10 5 4
7 1 6
5 3 9
10 7 3
8 4 3
SSBetween = n X −GM( )∑ 2
• Basically how much each group differs from the Grand Mean1. Subtract the GM
from each group mean
2. Square the diffs3. Weight by number
of scores
dfbetween =#groups−1=3−1=2
XA =8.0 XB =4.0 XC =5.0
SSA =18.0 SSB =20.0 SSC =26.0
=5 8 − 5.67( )2 + 5 4 − 5.67( )2 + 5 5 − 5.67( )2
=43.3
Formula alert:
SSBetween =T 2
n∑ −G 2
N
=402
5+
202
5+
252
5⎛⎝⎜
⎞⎠⎟
−852
15= 43.3
T=treatment totalN=#scores in treatment
G=grand total
PSY 340Statistics for the
Social Sciences Partitioning the variance
Total variance
Stage 1
Between groups variance
Within groups variance
SSTotal = X−GM( )∑ 2
dfTotal =N−1
SSWithin = SSeach group∑dfWithin = dfeach group∑
SSBetween = n X −GM( )∑ 2
dfbetween =#groups−1
PSY 340Statistics for the
Social Sciences Partitioning the variance
Total variance
Stage 1
Between groups variance
Within groups variance
SSTotal = X−GM( )∑ 2
dfTotal =N−1
SSWithin = SSeach group∑dfWithin = dfeach group∑
SSBetween = n X −GM( )∑ 2
dfbetween =#groups−1
Now we return to variance. But, we call it Means Square (MS)
MSWithin =SSWithin
dfWithinMSBetween =
SSBetween
dfBetween
Recall:variance =
SSdf
PSY 340Statistics for the
Social Sciences Partitioning the variance
Mean Squares (Variance)
SSBetween =43.3
dfbetween =2SSWithin =64dfWithin =12
MSBetween =43.32
=21.67 MSWithin =6412
=5.33
Within groups variance
Between groups variance
PSY 340Statistics for the
Social Sciences
• The F ratio– Ratio of the between-groups to the within-groups
population variance estimate
Step 4: Computing the F-ratio
• The F distribution• The F table
Observed variance
Variance from chanceF-ratio = =
MSBetween
MSWithin
=21.675.33
= 4.07
Do we reject or failto reject the H0?
PSY 340Statistics for the
Social Sciences Carrying out an ANOVA
• The F distribution • The F table– Need two df’s
• dfbetween (numerator)
• dfwithin (denominator)
– Values in the table correspond to critical F’s
• Reject the H0 if your computed value is greater than or equal to the critical F
– Often separate tables for 0.05 & 0.01
PSY 340Statistics for the
Social Sciences Carrying out an ANOVA
• The F distribution • The F table– Need two df’s
• dfbetween (numerator)
• dfwithin (denominator)
– Values in the table correspond to critical F’s
• Reject the H0 if your computed value is greater than or equal to the critical F
– Often separate tables for 0.05 & 0.01
Denominator df
1 2 3 4 5 6 …
1 1624,052
2005,000
2165,404
2255,625
2305,764
2345,859
2 18.5198.50
19.099.0
19.1799.17
19.2599.25
19.3099.30
19.3399.33
3 10.1334.12
9.5530.82
9.2829.46
9.1228.71
9.0128.24
8.9427.91
4 7.7121.20
6.9518.0
6.5916.7
6.3915.98
6.2615.52
6.1615.21
5 6.6116.26
5.7913.27
5.4112.06
5.1911.39
5.0510.97
4.9510.67
6 5.9913.75
5.1410.93
4.769.78
4.539.15
4.398.75
4.288.47
…
∞
Numerator df
Table B-4, pg 731-733Lightface type are Fcrits for α = 0.05
Boldface type are Fcrits for α = 0.01
PSY 340Statistics for the
Social Sciences Carrying out an ANOVA
• The F table– Need two df’s
• dfbetween (numerator)
• dfwithin (denominator)
– Values in the table correspond to critical F’s
• Reject the H0 if your computed value is greater than or equal to the critical F
– Often separate tables for 0.05 & 0.01
F =MSBetween
MSWithin
=21.675.33
= 4.07
Do we reject or failto reject the H0?
– From the table (assuming 0.05) with 2 and 12 degrees of freedom the critical F = 3.89.
– So we reject H0 and conclude that not all groups are the same
PSY 340Statistics for the
Social Sciences Summary of Example ANOVA
Criminal record Clean record No information
10 5 4
7 1 6
5 3 9
10 7 3
8 4 3XA =8.0
SSA =18.0
XB =4.0
SSB =20.0
XC =5.0
SSC =26.0
GM =X∑
N=8515
=5.67
SSTotal = X −GM( )∑ 2=107.33
dfTotal =N−1=15 −1=14
SSWithin = SSeach group∑ =64
dfWithin = dfeach group∑ =4 + 4 + 4 =12
SSBetween = n X −GM( )∑ 2=43.3
dfbetween =#groups−1=3−1=2
F =MSBetween
MSWithin
=21.675.33
= 4.07
MSWithin =SSWithin
dfWithin
=5.33
MSBetween =SSBetween
dfBetween=21.67
Fcrit(2,12) = 3.89, so we reject H0
dfA =4 dfB =4 dfC =4
PSY 340Statistics for the
Social SciencesNext time
• Basics of ANOVA• Why• Computations• Post-hoc and planned comparisons• Power and effect size for ANOVA• Assumptions • SPSS
– 1 factor between groups ANOVA– Post-hoc and planned comparisons
Top Related