Date post: | 18-Jan-2016 |
Category: |
Documents |
Upload: | albert-poole |
View: | 222 times |
Download: | 2 times |
Two-Way (Independent) ANOVA
PSYC 6130A, PROF. J. ELDER 2
Two-Way ANOVA
• “Two-Way” means groups are defined by 2 independent variables.
• These IVs are typically called factors.
• An experiment in which any combination of values for the 2 factors can occur is called a completely crossed factorial design.
• If all cells have the same n, the design is said to be balanced.
• Still have only 1 dependent variable
PSYC 6130A, PROF. J. ELDER 3
Example: Visual Grating Detection in Noise
200 ms
Until Response
500 ms
500 ms
PSYC 6130A, PROF. J. ELDER 4
2 x 3 Design
Noise Contrast
GratingFrequency
(c/deg)
0.5
1.7
4.3% 14.8% 50.0%
PSYC 6130A, PROF. J. ELDER 5
Balanced Design
10 10 10
10 10 10
Signal to Noiseat Threshold
.500
Signal to Noiseat Threshold
1.700
SpatialFrequency(cpd)
Count
.043
Count
.148
Count
.500
Noise Contrast (Michelson units)
Factor B
Factor A
PSYC 6130A, PROF. J. ELDER 6
Descriptive Statistics
.006 .003 .003
.004 .005 .008
Signal to Noiseat Threshold
.500
Signal to Noiseat Threshold
1.700
SpatialFrequency(cpd)
Std Deviation
.043
Std Deviation
.148
Std Deviation
.500
Noise Contrast (Michelson units)
.078 .064 .065 .069
.095 .089 .098 .094
.087 .076 .082 .082
Signal to Noiseat Threshold
.500
1.700
Spatial Frequency(cpd)
Group Total
Mean
.043
Mean
.148
Mean
.500
Noise Contrast (Michelson units)
Mean
GroupTotal
210.014571
1 ijT
s X XN
PSYC 6130A, PROF. J. ELDER 7
Interactions
• If there is no interaction between the factors (spatial frequency, noise contrast), the dependent variable (SNR) for each condition (cell) can be predicted from the independent effects of factors A and B:
– Cell mean = Grand mean + Row effect + Column effect
.078 .064 .065 .069
.095 .089 .098 .094
.087 .076 .082 .082
Signal to Noiseat Threshold
.500
1.700
Spatial Frequency(cpd)
Group Total
Mean
.043
Mean
.148
Mean
.500
Noise Contrast (Michelson units)
Mean
GroupTotal
PSYC 6130A, PROF. J. ELDER 8
Interactions
• If there are no interactions, curves should be parallel (effect of noise contrast is independent of spatial frequency).
PSYC 6130A, PROF. J. ELDER 9
Types of Effects
PSYC 6130A, PROF. J. ELDER 10
Interactions
• In the general case,
Cell mean = Grand mean + Row effect + Column effect + Interaction effect
• Score deviations from cell means are considered error (unpredictable).
• Thus:
Score = Grand mean + Row effect + Column effect + Interaction effect + Error
• OR
Score - Grand mean = Row effect + Column effect + Interaction effect + Error
PSYC 6130A, PROF. J. ELDER 11
Sum of Squares Analysis
errorwhere WSS SS
A B AB bet
betwhere is the between-groups sum-of-squares that would
be calculated by lumping all groups into one factor in a 1-Way ANOVA.
SS SS SS SS
SS
total A B AB errorSS SS SS SS SS
AB bet A B
AB
Thus
This provides a means for calculating .
SS SS SS SS
SS
Multiple Subscript and Summation Notation
PSYC 6130A, PROF. J. ELDER 13
Single Subscript Notation
3X
X
1
2
12
3
14
PSYC 6130A, PROF. J. ELDER 14
Double Subscript Notation
ijX
PSYC 6130A, PROF. J. ELDER 15
Double Subscript Notation
• The first subscript refers to the row that the particular value is in, the second subscript refers to the column.
11 12 13
21 22 23
31 32 33
X X X
X X X
X X X
PSYC 6130A, PROF. J. ELDER 16
Double Subscript Notation
• Test your understanding by identifying in the table below.
1 43 13
23 42 33
12 11 23
32X
1 43 13
23 42 33
12 11 23
PSYC 6130A, PROF. J. ELDER 17
Double Subscript Notation
• We will follow the notation of Howell:
number of in each cell in a balanced sco desr .e ns ign
number of levels for Factor .a A
number of levels for Facto .Br b
PSYC 6130A, PROF. J. ELDER 18
Multi-Subscript Notation
• In two-way ANOVA, 3 indices are needed:
kijXIndex identifies the lev Factorel of (the w) roi A
Index identifies the leve Factor l of (t che )olumnj B
Index identifies the individual within cell (k score , ).i j
Together, ( , ) identify the of the data table.celi j l
PSYC 6130A, PROF. J. ELDER 19
Multi-Subscript Notation• Statistics are calculated by summing over scores within
cells, and thus the third subscript (k) is dropped:
1
1 n
ij ijkk
X Xn
PSYC 6130A, PROF. J. ELDER 20
Multi-Subscript Notation
23Thus refers to the sample mean for the cell in , of the data table
(2nd level of and 3
R
r
ow 2
d leFa vector l of
Column 3
Facto )r
X
A B
41 refers to the sample mean for the cell in , of the data table
(4th level of and 1
Colu
st l
Ro
ev
w 4
Fact el of
mn 1
Facto or ) r
X
BA
PSYC 6130A, PROF. J. ELDER 21
Pooled Statistics
• Multi-factor ANOVA requires the calculation of statistics that pool, or ‘collapse’ data over one or more factors.
• We indicate the factors over which the data are being pooled by substituting a ‘bullet’ • for the corresponding index.
PSYC 6130A, PROF. J. ELDER 22
Pooled Statistics
1 1 1
1 1 is a 'column mean'
obtained by averaging over all scores in column
(all levels A of Factor )
a n a
j ijk iji k i
X X Xan a
j
1 1 1
1 1 is a 'row mean'
obtained by averaging over all scores in row
(all levels of Factor )B
b n b
i ijk ijj k j
X X Xbn b
i
a b
j1 1 1 1 1 i=1 j=1
1 1 1 1= X
b
is a 'grand mean' obtained by averaging
over all scores in the table.
a b n a b
ijk ij ii j k i j
X X X Xabn ab a
Six Step Procedure
PSYC 6130A, PROF. J. ELDER 24
0.62 0.29 0.31
0.36 0.54 0.80
Signal to Noiseat Threshold
.500
Signal to Noiseat Threshold
1.700
SpatialFrequency(cpd)
Std Deviation
.043
Std Deviation
.148
Std Deviation
.500
Noise Contrast (Michelson units)
Example
211.5
1 ijT
s X XN
7.8 6.4 6.5 6.9
9.5 8.9 9.8 9.4
8.7 7.6 8.2 8.2
Signal to Noiseat Threshold (%)
.500
1.700
Spatial Frequency(cpd)
Group Total
Mean
.043
Mean
.148
Mean
.500
Noise Contrast (Michelson units)
Mean
GroupTotal
PSYC 6130A, PROF. J. ELDER 25
Step 1. State the Hypothesis
• Null hypothesis has 3 parts, e.g.,
– Mean SNR at threshold same for both spatial frequencies
– Mean SNR at threshold same for all noise levels
– No interactions
PSYC 6130A, PROF. J. ELDER 26
Step 2. Select Statistical Test and Significance Level
• Normally use same -level for testing all 3 F ratios.
PSYC 6130A, PROF. J. ELDER 27
Step 3. Select Samples and Collect Data
• Strive for a balanced design
• Ideally, randomly sample
• More probably, random assignment
PSYC 6130A, PROF. J. ELDER 28
Step 4. Find Regions of Rejection
• Generally have 3 different critical values for each F test
1Bdf b
for all tests.W Tdf N ab
1Adf a
AB A Bdf df df
Denominator
Numerator
T 1Tdf N
Note that
T A B AB Wdf df df df df
PSYC 6130A, PROF. J. ELDER 29
Degrees of Freedom Tree
1Bdf b
W Tdf N ab
1Adf a
AB A Bdf df df
T 1Tdf N
1betdf ab
PSYC 6130A, PROF. J. ELDER 30
Step 5. Calculate the Test Statistics
2 2( 1)W ij ijk ij ijSS SS X X n s
2
bet ijSS n X X
2
A iSS bn X X
2
B jSS an X X
AB bet A BSS SS SS SS
2 2Sanity Check: ( 1)W A B AB T ij TSS SS SS SS SS X X N s
PSYC 6130A, PROF. J. ELDER 31
Step 5. Calculate the Test Statistics
AA
A
SSMS
df
BB
B
SSMS
df
ABAB
AB
SSMS
df
WW
W
SSMS
df
AA
W
MSF
MS
BB
W
MSF
MS
ABAB
W
MSF
MS
PSYC 6130A, PROF. J. ELDER 32
Step 6. Make the Statistical Decisions
• Note that 3 independent statistical decisions are being made.
• Thus the probability of one or more Type I errors is greater than the α value used for each test.
• It is not common to correct for this.
• You should be aware of this issue as both a producer and consumer of scientific results!
PSYC 6130A, PROF. J. ELDER 33
SPSS Output
Tests of Between-Subjects Effects
Dependent Variable: Signal to Noise at Threshold
.011a 5 .002 81.107 .000 .882
.399 1 .399 14644.217 .000 .996
.009 1 .009 344.657 .000 .865
.001 2 .001 18.802 .000 .411
.001 2 .000 11.637 .000 .301
.001 54 2.73E-005
.412 60
.013 59
SourceCorrected Model
Intercept
SpatialFreq
NoiseContrast
SpatialFreq *NoiseContrast
Error
Total
Corrected Total
Type III Sumof Squares df Mean Square F Sig.
Partial EtaSquared
R Squared = .882 (Adjusted R Squared = .872)a.
Main effects
Interaction
PSYC 6130A, PROF. J. ELDER 34
SPSS Output
2nX 2nX
2nX
Tests of Between-Subjects Effects
Dependent Variable: Signal to Noise at Threshold
.011a 5 .002 81.107 .000 .882
.399 1 .399 14644.217 .000 .996
.009 1 .009 344.657 .000 .865
.001 2 .001 18.802 .000 .411
.001 2 .000 11.637 .000 .301
.001 54 2.73E-005
.412 60
.013 59
SourceCorrected Model
Intercept
SpatialFreq
NoiseContrast
SpatialFreq *NoiseContrast
Error
Total
Corrected Total
Type III Sumof Squares df Mean Square F Sig.
Partial EtaSquared
R Squared = .882 (Adjusted R Squared = .872)a.
betSS2nX
ASS
BSS
ABSS
WSS2iX
TSS
PSYC 6130A, PROF. J. ELDER 35
Assumptions of Two-Way Independent ANOVA
• Same as for One-Way
• If balanced, don’t have to worry about homogeneity of variance.
PSYC 6130A, PROF. J. ELDER 36
Advantages of 2-Way ANOVA with 2 Experimental Factors
• One factor may not be of interest (e.g., gender), but may affect the dependent variable.
• Explicitly partitioning the data according to this ‘nuisance’ variable can increase the power of tests on the independent variable of interest.
PSYC 6130A, PROF. J. ELDER 37
Simple Effects
• When significant main effects are discovered, it is common to also test for simple effects.
PSYC 6130A, PROF. J. ELDER 38
Simple Effects
• A main effect is an effect of one factor measured by collapsing (pooling) over all other factors.
• A simple effect is an effect of one factor measured by fixing all other factors.
• Although we found significant main effects, given the significant interaction, these main effects do not necessarily imply similarly significant simple effects.
PSYC 6130A, PROF. J. ELDER 39
Simple Effects
• Thus, particularly when a significant interaction is observed, a factorial ANOVA is often followed up by a series of one-way ANOVAS to test simple effects.
• For our example, there are a total of 5 possible simple effects to test.
PSYC 6130A, PROF. J. ELDER 40
Simple Effects
• To conduct follow-up one-way ANOVA tests of simple effects in SPSS:
– Select Split File … from the Data menu
– Click on Organize Output by Groups
– Transfer the factor to be held constant to the space labeled “Groups Based On.”
– Now proceed with one-way ANOVAS as usual.
PSYC 6130A, PROF. J. ELDER 41
Simple Effects
Test of Homogeneity of Variances a
Signal to Noise at Threshold
5.120 2 27 .013
Levene
Statistic df1 df2 Sig.
Spatial Frequency (cpd) = .500a.
ANOVAa
Signal to Noise at Threshold
.001 2 .001 32.990 .000
.001 27 .000
.002 29
Between GroupsWithin Groups
Total
Sum ofSquares df Mean Square F Sig.
Spatial Frequency (cpd) = .500a.
Robust Tests of Equality of Meansb
Signal to Noise at Threshold
21.413 2 16.975 .00032.990 2 17.382 .000
WelchBrown-Forsythe
Statistica df1 df2 Sig.
Asymptotically F distributed.a.
Spatial Frequency (cpd) = .500b.
PSYC 6130A, PROF. J. ELDER 42
Simple Effects
Test of Homogeneity of Variancesa
Signal to Noise at Threshold
2.037 2 27 .150
LeveneStatistic df1 df2 Sig.
Spatial Frequency (cpd) = 1.700a.
ANOVAa
Signal to Noise at Threshold
.000 2 .000 5.899 .007
.001 27 .000
.001 29
Between GroupsWithin GroupsTotal
Sum ofSquares df Mean Square F Sig.
Spatial Frequency (cpd) = 1.700a.
Robust Tests of Equality of Meansb
Signal to Noise at Threshold
5.527 2 16.511 .0155.899 2 19.883 .010
WelchBrown-Forsythe
Statistica df1 df2 Sig.
Asymptotically F distributed.a.
Spatial Frequency (cpd) = 1.700b.
PSYC 6130A, PROF. J. ELDER 43
Simple Effects
• Again note that multiple independent statistical decisions are being made.
• Conditioning the test for simple effects on a significant main effect provides protection if only 2 simple effects are being tested.
• Otherwise, the probability of one or more Type I errors is greater than the α value used for each test.
• It is not common to correct for this.
• You should be aware of this issue as both a producer and consumer of scientific results!
End of Lecture
April 8, 2009
PSYC 6130A, PROF. J. ELDER 45
Planned or Posthoc Pairwise Comparisons
• If significant main (and possibly simple) effects are found, it is common to follow up with one or more pairwise tests.
• It is most common to test differences between marginal means within a factor (i.e., pooling over the other factor).
• In this example, there are only 3 meaningful posthoc tests on marginal means. Why?
PSYC 6130A, PROF. J. ELDER 46
Pairwise Comparisons on Marginal Means
• Since there are 3 levels of noise, we can consider using Fisher’s LSD.
• However, since variances do not appear homogeneous, we should not use an LSD based on pooling the variance over all 3 conditions.
Multiple Comparisons
Dependent Variable: Signal to Noise at Threshold
LSD
.010120* .004492 .028 .00112 .01912
.004800 .004492 .290 -.00420 .01380
-.010120* .004492 .028 -.01912 -.00112
-.005320 .004492 .241 -.01432 .00368
-.004800 .004492 .290 -.01380 .00420
.005320 .004492 .241 -.00368 .01432
(J) Noise Contrast(Michelson units).148
.500
.043
.500
.043
.148
(I) Noise Contrast(Michelson units).043
.148
.500
MeanDifference
(I-J) Std. Error Sig. Lower Bound Upper Bound
95% Confidence Interval
The mean difference is significant at the .05 level.*.
Test of Homogeneity of Variances
Signal to Noise at Threshold
12.229 2 57 .000
LeveneStatistic df1 df2 Sig.
PSYC 6130A, PROF. J. ELDER 47
Pairwise Comparisons on Marginal Means
• Alternative when variances appear heterogeneous:
– Compute Fisher’s LSD by hand, calculating standard error separately for each test (not difficult)
– One of the unequal variance post-hoc tests offered by SPSS
Multiple Comparisons
Dependent Variable: Signal to Noise at Threshold
Games-Howell
.010120* .003787 .030 .00085 .01939
.004800 .004573 .552 -.00648 .01608
-.010120* .003787 .030 -.01939 -.00085
-.005320 .005028 .546 -.01762 .00698
-.004800 .004573 .552 -.01608 .00648
.005320 .005028 .546 -.00698 .01762
(J) Noise Contrast(Michelson units).148
.500
.043
.500
.043
.148
(I) Noise Contrast(Michelson units).043
.148
.500
MeanDifference
(I-J) Std. Error Sig. Lower Bound Upper Bound
95% Confidence Interval
The mean difference is significant at the .05 level.*.
PSYC 6130A, PROF. J. ELDER 48
Planned or Posthoc Pairwise Comparisons
• It is also possible to test differences between cell means. Note that in this design, there are 15 possible pairwise cell comparisons.
• It doesn’t make that much sense to compare 2 cells that are not in the same row or column (i.e. that differ in both factors).
• It is more likely that you would follow a significant simple effect test with a set of pairwise comparisons within a factor while holding the other factor constant. There are 9 such comparisons possible here.
• For example, within a spatial frequency condition, what noise conditions differ significantly?
• This defines a total of 6 pairwise comparisons (2 families of 3 comparisons each).
PSYC 6130A, PROF. J. ELDER 49
Planned or Posthoc Pairwise Comparisons
• Alternative when variances appear heterogeneous:
– Compute Fisher’s LSD by hand, calculating standard error separately for each test (not difficult)
– One of the unequal variance post-hoc tests offered by SPSS (assumes all-pairs)
Multiple Comparisonsa
Dependent Variable: Signal to Noise at Threshold
Games-Howell
.005890* .002067 .030 .00055 .01123
-.003160 .002790 .513 -.01056 .00424
-.005890* .002067 .030 -.01123 -.00055
-.009050* .003066 .024 -.01697 -.00113
.003160 .002790 .513 -.00424 .01056
.009050* .003066 .024 .00113 .01697
(J) Noise Contrast(Michelson units).148
.500
.043
.500
.043
.148
(I) Noise Contrast(Michelson units).043
.148
.500
MeanDifference
(I-J) Std. Error Sig. Lower Bound Upper Bound
95% Confidence Interval
The mean difference is significant at the .05 level.*.
Spatial Frequency (cpd) = 1.700a.
PSYC 6130A, PROF. J. ELDER 50
Interaction Comparisons
• If significant interactions are found in a design that is 2x3 or larger, it may be of interest to test the significance of smaller (e.g., 2x2) interactions.
• These can be tested by ignoring specific subsets of the data for each test (e.g., by using the SPSS Select Cases function).
PSYC 6130A, PROF. J. ELDER 51
Unbalanced Designs for Two-Way ANOVA
• Dealing with unbalanced designs is easy for One-Way ANOVA.
• Dealing with unbalanced designs is trickier for Two-Way.
PSYC 6130A, PROF. J. ELDER 52
Simple Solution
• Let n = harmonic mean of sample sizes.
• Calculate marginal means as an unweighted mean of cell means (not the pooled mean).
PSYC 6130A, PROF. J. ELDER 53
Better Solution
• Regression approach to ANOVA (will not cover)