You are on page 1of 29

Analysis of Variance

ANOVA

Libeeth B. Guevarra
libeeth.guevarra@cit.edu

Groups: A, B, C
compare:
A, B
A, C
B, C

Psych152 - Psychological Statistics 1


One Way ANOVA

The analysis of variance is used to test the hypothesis that the


means of three or more populations are the same against the
alternative hypothesis that at least one population mean differs.
Ho: Mean1=Mean2=Mean3
Ha: at least 1 Mean is different

Psych152 - Psychological Statistics 2


The F test which can be used to compare two variances, can also be
used to compare at least three means.

This technique is called analysis of variance, or ANOVA because the


test is based on the analysis of variation in the data obtained from
different sample.

Psych152 - Psychological Statistics 3


Example
Suppose a researcher would want to try three different methods to
cope depression during quarantine period. The subjects are randomly
assigned to three groups; first group takes Method A, the second
group takes Method B, and the third group takes Method C. After 2
weeks, depression levels were measured. Test difference of these
coping methods.

Psych152 - Psychological Statistics 4


Using a one-way ANOVA test, only one factor or variable is
analyzed.
Example:
testing for the equality equality of the coping methods
=⇒ only one factor.
(effect of different coping methods on the depression.)

Psych152 - Psychological Statistics 5


Analyze the effects of two factors.
Example: different individuals (grouped according to their socio
economic status) using these three methods of coping depression
=⇒ analyze the effects of socio economic status and methods
of coping depression.
=⇒ This is done by using a two-way ANOVA.

Psych152 - Psychological Statistics 6


NOTE:
The F test can only show whether a difference exists among the
means.
=⇒ It cannot reveal where the difference lies.

=⇒ If the F test indicates that there is a difference among the


means, other statistical test are used to find where the
difference exists.

Psych152 - Psychological Statistics 7


The ANOVA that is used to compare at least three means that
contains only one variable is called one way analysis of variance.

Assumptions for the F Test for comparing at least three


means:
The populations from which the samples were obtained must be
normally or approximately normally distributed.
The samples must be independent of one another.
The variances of the populations must be equal.

Psych152 - Psychological Statistics 8


The ANOVA test is applied by calculating two estimates of the
variance, σ 2 , of population distributions:

VARIANCE BETWEEN SAMPLES and the VARIANCE


WITHIN SAMPLES.

The variance between samples is also called the mean square between
samples or MSB.

The variance within samples is also called the mean square within
samples of MSW.

Psych152 - Psychological Statistics 9


The variance between samples, MSB, gives an estimate of σ 2 based
on the variation among the means of samples taken from different
populations.

For the example of three coping methods, MSB will be based on the
values of the mean level of depression of three sample groups (three
different methods)

Psych152 - Psychological Statistics 10


If the means of all populations under consideration are equal, the
means of the respective samples will still be different but the
variation among them is expected to be small, and consequently, the
value of MSB is expected to be small.

However, if the means of populations under consideration are not all


equal, the variation among the means of respective samples is
expected to be large, and consequently, the value of MSB is expected
to be large.

Psych152 - Psychological Statistics 11


The variance within samples, MSW, gives an estimate of σ 2 based on
the variation within the data of different samples.

For the example of three coping methods, MSW will be based on the
scores of individual students included in the three samples taken from
three populations.

Psych152 - Psychological Statistics 12


Is always right-tailed with the rejection region in the right tail of the
F distribution curve.

The hypothesis-testing procedure using ANOVA involves the same


five steps that were used in the previous sessions.

Psych152 - Psychological Statistics 13


Test Statistic F for a One-Way ANOVA Test

The value of the test statistic F for a test of hypothesis using


ANOVA is given by the ratio of two variances, the variance between
samples (MSB) and the variance within samples (MSW).

Variance between samples MSB


F = =
Variance within samples MSW

Psych152 - Psychological Statistics 14


Source Sum of Squares d.f. Mean Square F
Between SSB k −1 MSB
Within (error) SSW N −k MSW
Total
SSB = sum of squares between groups
Tk2
 2
T22 ( x)2
 P
T1
= + + ··· + −
n1 n2 nk N
SSW = sum of squares within groups
T2
 2
T2

X T1
= x2 − + 2 + ··· + k
n1 n2 nk
k = number of groups
N = n1 + n2 + · · · + nk (sum of sample sizes for groups)

Psych152 - Psychological Statistics 15


SST = SSB + SSW
SSB
MSB =
k −1
SSW
MSW =
N −k
MSB
F =
MSW
The totals are obtained by adding corresponding columns.

Psych152 - Psychological Statistics 16


Example
A researcher investigate the number of viral infections people
contract as a function of the amount of stress they experienced
during a 6-month period. She obtained the data below. Is it sufficient
enough to say that the number of viral infections people contract is
the same regardless of their stress level using 5% significance level?
Negligible Minimal Moderate Severe
Stress Stress Stress Stress
2 4 6 5
1 3 5 7
4 2 7 8
1 3 5 4

RJECT ho since F is greater than F crit ANOVA SINGLE


and P value is less than the alpha FACTOR IN EXCEL

Psych152 - Psychological Statistics 17


Example
A researcher wishes to see whether there is any difference in the
weight gains of athletes following one of three special diets. Athletes
are randomly assigned to three groups and placed on the diet for 6
weeks. The weight gains (in pounds) are shown below. At α = 0.05,
can the researcher conclude that there is a difference in the diets?
Diet A Diet B Diet C
3 10 8
6 12 3
7 11 2
4 14 5
8
6

ANOVA SINGLE FACTOR IN EXCEL

Psych152 - Psychological Statistics 18


Assignment
Example
Here are data from an experiment studying the effect of age on
creativity scores:
Age 4 Age 6 Age 8 Age 10
3 9 9 7
5 11 12 7
7 14 9 6
4 10 8 4
3 10 9 5

At 10% significance level, can we conclude that there is a difference


among the creativity scores of the groups?

ANOVA SINGLE FACTOR IN EXCEL

Psych152 - Psychological Statistics 19


Assignment
Example
Several students volunteered for an alumni phone-a-thon to solicit
alumni gifts. The number of calls made by randomly selected
students from each class is listed. At α = 0.05, is there sufficient
evidence to conclude a difference in means?
Freshmen Sophomores Juniors Seniors
25 17 20 20
29 15 24 25
32 20 25 26
15 26 30 15
18 30 15 19

ANOVA SINGLE FACTOR IN EXCEL

Psych152 - Psychological Statistics 20


Scheffé Test

Compare the means two at a time, using all possible


combinations of means.
(x̄i −x̄j )2
FS =   where x̄i and x̄j are the means of the samples
1
MSW ni
+ n1
j
being compared, ni and nj are the respective sample sizes, and
MSW is the within group variance.
Critical value F 0 for the Scheffé test, F 0 = (k − 1)(CV of F )
There is a significant difference between the two means being
compared when FS is greater than the F 0

Psych152 - Psychological Statistics 21


Tukey Test (q)

This test can also be used after the analysis of variance has been
completed to make pairwise comparison between means when the
groups have the same sample size.
x̄i − x̄j
q=q
MSW
n

When the absolute value of q is greater than the critical value for the
Tukey test, there is a significant difference between the two means
being compared.

Psych152 - Psychological Statistics 22


Investigate

Using the following summary data, perform a one way ANOVA using
α = 0.1
n Mean SD
30 50.26 10.45
30 45.32 12.76
30 53.67 11.47

Note:
s12 +s22 +···+sk2
MSW = k
d.f .W = N − k SSW = MSW × d.f .W

Psych152 - Psychological Statistics 23


Two Way ANOVA

The two-way ANOVA is an extension of the one-way analysis of


variance.
It involves two independent variables, called factors
In doing a study that involves a two-way analysis of variance, the
researcher is able to test the effects of two independent
variables on one dependent variable.
In addition, the interaction effect of the two variables can be
tested.

Psych152 - Psychological Statistics 24


In general, the two-way ANOVA summary table is set up as
shown below:
Source Sum of Squares d.f. Mean Square F
A SSA a−1 MSA FA
B SSB b−1 MSB FB
A×B SSA×B (a − 1)(b − 1) MSA×B FA×B
Within SSW ab(n − 1) MSW
Total

Psych152 - Psychological Statistics 25


SSA = sum of squares for factor A
SSB = sum of squares for factor B
SSA×B = sum of squares for interaction
SSW = sum of squares for error term (within group)
a = number of levels of factor A
b = number of levels of factor B
n = number of subjects in each group
SSA
MSA =
a−1
SSB
MSB =
b−1

Psych152 - Psychological Statistics 26


SSA×B
MSA×B =
(a − 1)(b − 1)
SSW
MSW =
ab(n − 1)
MSA
FA =
MSW
MSB
FB =
MSW
MSA×B
FA×B =
MSW

Psych152 - Psychological Statistics 27


Assumptions for the Two-Way ANOVA
The populations from which the samples were obtained must be
normally or approximately normally distributed.
The samples must be independent.
The variances of the populations from which the samples were
selected must be equal.
The groups must be equal in sample size.

Psych152 - Psychological Statistics 28


Example
A study compared the performance of males and females tested by
either a male or a female experimenter. Here are the data:

Participant
Experimenter Male Female
Male 6, 11, 9, 10, 9 8, 14, 17, 16, 19
Female 8, 10, 9, 7, 10 4, 6, 5, 5, 7

1 Using α = 0.05 perform an ANOVA and complete the summary


table.
2 Compute the main effect means and interaction means.
3 Perform the appropriate post hoc comparisons.

ANOVA TWO WAY IN JASP

Psych152 - Psychological Statistics 29

You might also like