Chapter
8
Analysis
of
Variance
Outline
Introduc)on
Logic
of
ANOVA
Independent
Samples
One-way
ANOVA
Eect
Size
and
Power:
Eta-squared
(
2
)
Omega-squared
(
2
)
Cohens
f.
Power
computa)ons
Mul)ple
Comparison
Procedures
Repeated
Measures
One-way
ANOVA:
Basic
Ideas,
Structural
Model;
Computa)on;
Contrasts;
Post
Hoc
test,
Assump)on
of
Sphericity
Factorial
Analysis
of
Variance:
Two-way
Completely
Independent
ANOVA:
Basic
Ideas;
Main
Eect
and
Interac)on
eect;
The
Structural
Model
and
Par))oning
Sum-of-squares;
Computa)onal
Formula
The
Alterna)ve
Factorial
ANOVA
Designs:
1.
Mixed-factorial
ANOVA;
2.
Completely
Repeated
Measures
Factorial
ANOVA
Mul)variate
Analysis
of
Variances
(MANOVA)
Statistical
IV
Levels
DV
Example
Technique
(Factor)
of
IV
Independent
One
Two
One
Experimental
and
Control
Samples
t-test
group
comparison
Dependent
One
Two
One
Pre-test
post-test
design
Samples
t-test
Independent
One
More
One
Comparisons
of
three
Samples
One- than
treatments
(BT,
CBT,
SPT)
way
ANOVA
Two
for
depression
Dependent
One
More
One
Comparison
of
same
Samples
One- than
participants
under
three
way
ANOVA
Two
experimental
conditions
Factorial
Two
or
Two
or
One
3
!
2
factorial
design;
ANOVA
More
more
for
IV1:
Treatment
(CBT,
BT,
each
IV
and
SPT)
and
IV2:
BPD
(Present
and
Absent)
and
DV
is
depression
MANOVA
One
or
Two
or
More
Gender
difference
on
four
More
more
for
than
measures
of
Neuroticism
each
IV
one
Logic
of
ANOVA
For
k
groups,
the
comparisons
are
( k k 1) 2 = ( 4 3) 2 = 12 2 = 6 !
The
Type
I
error
for
those
many
(for
example,
3)
comparisons
are
(if
we
use
t-test)
( )
P = 1 (1 )r = 1 (1 .05)3 = 1 .95 3 = 1 .857 = .1426 !
The
chance
that
we
reject
null
when
we
should
have
accepted
it
is
0.1426
for
at
least
one
comparison.
Alterna)ve
is
ANOVA
Founda<ons
of
ANOVA
F-random
variable
12 1
F= 2 !
2 2
The
F
distribu)on
is
+ 2 1
1
1
(1 + 2 )
2 1 2 1
1 1 2
f (x) = x 2
1 + x !
1 2 2
2
2 2
S 2
2
S
The
F
is
equal
to
Fn 1,n 1 = 1 1 = 1 !
2
1 1
S2 2 S2
2 2 2
we have independent random samples
from k populations of size n.
Logic
of
ANOVA
denote xij as i th value in j th population.
If xij is normally distributed with mean
and variance 2 , then we can state that
xij = j + eij
If xij ~ N ( , 2 ) then
xij = + j + eij
where j = 1,, k; i = 1, 2,, n, = grand mean,
j is a treatment effect of the j th group.
The treatment effect is stated as
k
j =0
j=1
H 0 : j = 0
H 0 : j 0
Independent
Samples
One-way
ANOVA
Omnibus
null
hypothesis
regarding
equality
of
popula)on
means
for
all
k-groups.
Par)cipants
are
independent
(o\en
randomly
assigned).
Assump)ons
Normality:
Popula)ons
are
normally
distributed
Homogeneity
of
variances:
Popula)on
variances
of
all
k-groups
are
equal.
H 0 : 1 = 2 = ... = k !
Independence:
HA : j !
Basic
Equa<ons
k n k k n
(X ij X)2 = n (X j X)2 + (Xij X j )2
j=1 i=1 j=1 j=1 i=1
SST = SSbet + SSwithin
k n
SSwithin = (Xij X j )2
j=1 i=1
k n
SSbet = (Xij X j )2
j=1 i=1
dfwithin = ( n1 1) + ( n2 1) + ...+ ( nk 1) dfBetween = k 1
dfTotal = ( ntotal 1)
Basic
Equa<ons
MSBet = SSbetween dfBetween
MSW = SSWithin dfWithin
MSBet
F=
MSW
Solve
Example
8.2
in
the
book
using
these
computa)ons
formula.
Summary
Table
for
Example
8.2
Source
SS
df
MS
F
Between
170.6
3
2
=
2
85.30
6.908
Within
333.4
9
+
9
+
9
=27
12.35
Total
504
30
1
=
29
Use
R
Code
8.4
and
8.5
for
compu)ng
ANOVA.
Eect
Size
Eta-squared
SSbet
2 = !
SSTotal
MSW
Adjusted = 1
2
!
MST
Omega-squared
SS (k 1) MSW
2 = bet !
SSTotal + MSW
Cohens
f
2
f= !
1 2
Power
Calcula<ons
for
One-way
ANOVA
= f n! = /k !
= /k!
2
k=!
2
The
is
a
non-centrality
parameter.
Power
is
computed
using
NCP.
Sample
size
can
also
be
determined
by
using
the
eect
size
f= n Compute
power
by
using
R
Code
2
! 8.6
and
8.7
in
the
book.
2 f = n
Mul<ple
Comparison
Procedures
Error
Rate
Per
Comparison
Type
I
Error
Rate
()
Family-wise
Type
I
Error
Rate
(fw)
Types
of
Comparisons
Planned
comparisons
or
a
priory
comparisons
Post
hoc
or
unplanned
comparisons
or
posteriori
comparisons
Do
we
need
Signicance
of
F?
Planned
Comparisons
Contrasts
k
a X j j = a1 X1 + a2 X2 + + ak X k = !
j=1
k
Linear
Contrasts
c j =0!
j=1
k
= cj X j !
j=1
Planned
Comparisons
Mul<ple
t-test
Xi X j Xi X j
t= = !
MSW MSW 2MSW
+
n n n
The
BonferroniDunn
test
Bonferroni
Inequality
( )
P Ei P ( Ei )
i =1
i =1
Planned
Comparisons
fw c = pc !
fw c pc = c fw c ! ( )
2
F= !
a j MSW
2
n
Evaluate
F
at
pc
Dunnidk
Correc<on
Planned
Comparisons
Holms
and
Larzelere
and
Mulaik
Test
Mul)stage
Test
(i)
Compute
the
t-values
as
is
discussed
in
Bonferroni
Dunn.
(ii)
Disregarding
the
sign,
arrange
all
t-values
as
per
the
ascending
order,
c
is
the
number
of
contrasts
tested
or
comparisons
carried
out.
(iii)
The
t
is
tested
for
signicance
using
Dunns
cri)cal
c
value
at
c
contrasts.
Then
t
is
tested
for
signicance
c 1
using
Dunns
cri)cal
value
at
c
1
contrasts,
and
so
on
Post
Hoc
Tests
Least
Signicant
Dierence
(LSD)
1
(
LSD = t /2,dfw MSW 1 n + 1 n + + 1 n !
2 k
)
DunneXs
Procedure
2MSW
CDD = t D !
n
Post
Hoc
Tests
Studen<zed
Range
Sta<s<cs
(q)
X L XS
qr = !
MSW n
Tukeys
HSD
or
WSD
Test
MSW
HSD = q !
n
Post
Hoc
Tests
TukeyKramer
Procedure:
HSD
for
Unequal
Sample
MSe MSe
+
n1 n2
!
2
GamesHowell
Procedure:
Unequal
n
and
Unequal
Variances
2 2
S1 S2
+
n1 n2
CDGH = q.05(r, df ) !
2
Post
Hoc
Tests
Sche
Test
( k 1)( Fdfb, dfw )
2MSW
CDS = !
n
Newman
Keuls
Procedure
MSW
CDNK = q(spets,dfw) !
n
Post
Hoc
Tests
RyanEinotGabrielWelsch
Q
(REGWQ)
Procedure:
Hochberg
GT2
Hochberg
H2,
Tamhane
T2,
and
Dunnei
T3
BenjaminiHochberg
Test
WallerDuncan
Bayesian
Test
Use
R
Code
8.8
,
8.9,
8.10,
8.11,
8.12,
and
8.13
from
the
book
for
mul)ple
comparison
procedures.
Repeated
Measures
One-way
ANOVA
Same
par)cipant
in
dierent
condi)ons
Par)cipants
are
matched
across
condi)ons
Prac)ce
Eect
Counterbalancing
La)n
Squares
Design
Randomiza)on
of
Orders
Structural
Model
where Xij = + i + j + eij !
Xij is a score of i th participants in j th treatment
is a grand mean
i is a constant of i th person
j is a constant associated with j th treatment
eij is a error associate with i th participants in j th treatment
i represents the extent to which each persons/subjects score departs
from the mean of person/subject. It is assumed to distributed with mean zero.
j is representative of the difference between treatment mean and
average treatment mean.
eij is distributed around mean zero.
eij and i are iid
Computa<on
( )!
ntotal
SST = Xij X
2
dfT = ntotal 1 !
i=1
( )
k
SStreat = n X j X
2
! dftreat = k 1 !
j=1
dfsub = nsub 1 !
( )
nsub
SSsub = k X sub X
2
!
i=1
SSerror = SST ( SStreat + SSsub ) ! dferror = dftreat dfsub !
MStreat = SStreat dftreat ! MSerror = SSerror dferror !
MStreat Solve
with
example
data
in
Table
8.9
F= ! from
the
book.
MSerror
Summary
Table
Source' SS' df# MS' F# P#
SSsub ' 34.83' dfsub = nsub 1 = 10 1 = 9 ' 3.87' MStreat <.01%
F=
SStreat ' 35.00' dftreat = k 1 = 3 1 = 2 ' 17.50' MSerror '
'
SSerror ' 23.67' dferror = dftreat dfsub = 2 9 = 18 ' 1.315' 17.5 '
= = 13.31
SST ' 93.50' dfT = ntotal 1 = 30 1 = 29 ' ' 1.315 '
%
Use
R
Code
8.14
from
the
book
for
solving
the
repeated
measures
ANOVA.
Assump<on
of
Sphericity
Constant
variance
and
constant
covariance
of
the
popula)on
variance
covariance
matrix.
Its
is
es)mated
by
sample
matrix.
Mauchly's
sphericity
test.
Use
R
Code
8.15
from
the
book
to
carry
out
Mauchly's
sphericity
test.
Factorial
Analysis
of
Variance:
Two-way
Completely
Independent
ANOVA
Factorial
Designs:
More
than
one
IV
Each
IV
is
at
Two
or
more
levels
Three
basic
types
Completely
randomized
(All
cells
independents)
Completely
Repeated
Mixed
(One
IV
is
Randomized
other
Repeated)
Main
Eect
and
Interac<on
Eect
The
main
eect
in
factorial
ANOVA
is
referred
to
the
impact
of
individual
factor
or
IV
on
the
dependent
variable.
Interac)on
eect
is
the
joint
eect
of
independent
variables.
Impact
of
one
of
the
factor
on
DV
changes
as
levels
of
the
other
factor
changes.
Example
IV1:
Media
Condi)on
(2
levels:
Audiotape
or
Videotape)
IV2:
Openness
to
Experience
(2
levels:
Low-openness
and
High-openness)
! ! IV#1:#Media#Condition# !
! ! L1:!Audiotape! L2:!Videotape! !
# L1:!Low1 Low1O!&! Low1O! Low1O!!
IV2:# Openness! Audiotape!! Videotape!! n!=!60!
Openness# n!=!30! n!=!30!
L2:!High1 High1O!&! High1O!&! High1O!!
Openness! Audiotape!! Videotape! n!=!60!
n!=!30! n!=!30!
! ! n!Audiotape!=! n!Videotape!=! Total!n!=!120!
60! 60!
!
Null
and
Alterna<ve
Hypothesis
H 0 : mAudiotape = mVideotape
H A : mAudiotape mVideotape
H 0 : LowO = HighO !
H A : LowO HighO !
H0 : Absence of Interaction Effect
Structural
Model
Xijk = + j + k + ( ) jk + eijk !
Xijk is#any#ith#observation#for#combination#of#(jk)th#cell.##
#is#constant#population#mean##
j is#effect#of#first#factor#(A)#which#is# j #
k is#effect#of#second#factor#(B)#which#is# k #
( ) jk is#interaction#effect#between#first#and#second#factor#(A*B)#
eijk is#error#associated#with#observation# Xijk .#The#error#follows#normal#with#mean#
zero#and#variance# 2 .##
#
Computa<onal
Formula
( )
n
dftotal = ntotal 1
2
SST = Xijk X !
i=1
( )
n n
SSerror = SSWC = Xijk X jk = ( Xi Xcell ) !
2 2
dfWC = (n jk 1)
i=1 i=1
( )!
2
SSIV 1 = n j X j X dfIV 1 = J 1
= n (X X) !
2
SSIV 2 k k dfIV 2 = k 1
SSIV 1IV 2 = SST ( SSIV 1 + SSIV 2 + SSerror ) ! df
IV 1IV 2 = ( j 1) ( k 1)
( )!
2
SScell = n jk X jk X
Summary
Table
Sum!Sq! Df! Mean!Sq! F!value! Pr(>F)!
!
Media! 8.1$ 1$ 8.1$ 10.196$ 0.00292$
Opn! 44.1$ 1$ 44.1$ 55.51$ <$0.0001$
Opn*Media! 3.6$ 1$ 3.6$ 4.531$ 0.04019$
Residuals! 28.6$ 36$ 0.79$
Total! 84.4$ $ $
! $ $ $ $
Use
example
data
in
Table
8.14
from
the
book.
Use
R
Code
8.16
from
the
book.
Alterna<ve
Factorial
ANOVA
Designs
Mixed-factorial
ANOVA
SSTotal = SSIV 1 + SSwithin + SSIV 2 + SSIV 1IV 2 + SSIV 2within !
Use
R
Code
8.17
from
book.
Completely
Repeated
Measures,
Factorial
ANOVA
Use
R
Code
8.18
from
book.
Mul<variate
Analysis
of
Variances
(MANOVA)
More
dependent
variables
and
DVs
are
intercorrelated
For
example,
IV
=
Gender
(Levels:
malefemale)
DV:
Anxiety
(A),
Impulsiveness
(Im),
Vulnerability
(Vu)
and
Hos)lity
(Ho)
subscales
of
Assump<ons
and
Other
Important
Aspects
of
MANOVA
Mul)variate
Normal
Distribu)on
(MVN)
and
Outliers
Homogeneity
of
VarianceCovariance
Matrices
Mul)collinearity
and
Singularity
Linearity
Homogeneity
of
Regressions
Reliability
of
Covariates
Sample
Size
Null
and
Alterna<ve
Hypothesis
for
MANOVA
Null:
All
groups
have
the
same
vector
of
popula)on
means.
Male Female Male Female
A A A A
lm lm lm lm !
H0 : = HA :
Vu Vu Vu Vu
Ho Ho Ho Ho
Test
Sta)s)cal
test
is
Wilks
Lambda
S error
= !
S effect + S error
where,&&
S&is&as&Sum&of&Squares&and&Cross&Products&(SSCP)&matrix;&
Serror is#a#SSCP#of#within##
Seffect is#SSCP#of#effect#(or#between).##
Serror is#a#determinant#of# Serror #
Seffect + Serror is#a#determinant#of#addition#of# Seffect + Serror matrices.##
The# will#be#close#to#zero#if# Serror is#small##
The# will#be#close#to#one#if# Serror is#large.##
#
Distribu<on
and
Signicance
Signicance
of
the
Wilks
lambda
1 y df2
Approximate F(df1 ,df2 ) = !
y df1
y= ! ( )
1/s
s = min p,dfeffect !
( )
p dfeffect + 1 p dfeffect 2
(
df1 = p dfeffect ! )
df2 = ( dferror )
2
2
!
2 = ( N 1) 0.5 ( p + k ) ln
df = p(k 1)
Use
8.8.4
small
sample
worked
out
example
from
book.
Usr
R
Code
8.19
and
8.21.