Beruflich Dokumente
Kultur Dokumente
Page
1. What is a contrast?
A focused test of means
A weighted sum of means
Contrasts allow you to test your research hypothesis (as opposed to the
statistical hypothesis)
HS College Students
Students Math Chemistry English History
1 2 3 4 5
HS College Students
Students Math Chemistry English History
1 2 + 3 + 4 + 5
4
2 + 3 + 4 + 5 2 + 3 + 4 + 5
H 0 : 1 = H 1 : 1
4 4
HS College Students
Students Math Chemistry English History
2 + 3 4 + 5
2 2
2 + 3 4 + 5 2 + 3 4 + 5
H0 : = H1 :
2 2 2 2
HS College Students
Students Math Chemistry English History
2 3
H 0 : 2 = 3 H1 : 2 3
HS College Students
Students Math Chemistry English History
4 5
H 0 : 4 = 5 H1 : 4 5
a
= c i X i = c1 X1 + c 2 X 2 + c 3 X 3 + ...+ c a X a
j =1
o Where
(1, 2 ,3 ,...,a ) are the population means for each group
(X1, X 2 ,X 3 ,...,X a ) are the observed means for each group
(c1,c 2 ,c 3 ,...,c a ) are weights/contrast coefficients
a
with c i =0
i=1
1 1 1 1 1 1 1 1
1 = 1 2 3 4 5 c = 1, , , ,
4 4 4 4 4 4 4 4
1 1 1 1 1 1 1 1
2 = 2 + 3 4 5 c = 0, , , ,
2 2 2 2 2 2 2 2
3 = 2 3 c = (0,1,1,0,0 )
Pairwise contrasts
o Comparisons between two cell means
o Contrast is of the form ci = 1 and ci = 1 for some i and i
a( a 1)
o If you have a groups then there are possible pairwise contrasts
2
o Examples:
Do math majors score differently than chemistry majors?
3 = 2 3 c = (0,1,1,0,0 )
Do English majors score differently than history majors?
4 = 4 5 c = (0,0,0,1,1)
o When there are two groups (a = 2), then the two independent samples t-
test is equivalent to the c = (1,1) contrast on the two means.
Complex contrasts
o A contrast between more than two means
o There are an infinite number of contrasts you can perform for any design
o So long as the coefficients sum to zero, you can make any comparison:
k = .011 .08 2 .98 3 + .58 4 + .47 5 c = (.01,.08,.98,.58,.47 )
o Orthogonality defined:
A set of contrasts is orthogonal if they are independent of each other
(or if knowing the value of one contrast in no way provides any
information about the other contrast)
a
a b = 0 or
i i a1b1 + a2 b2 + ...+ aa ba = 0
j=1
anb i i
= 0 or
a1b1 a2 b2
n1
+
n2
ab
+ ... + a a = 0
na
j= 1 i
c1 c2
= 1+ 0 + 0 = 1
o If you have a groups, then there are a-1 possible orthogonal contrasts
We lose one contrast for the grand mean (the unit contrast)
Having the contrasts sum to zero assures that they will be orthogonal
to the unit contrast
If you have more than a-1 contrasts, then the contrasts are redundant
and you can write at least one contrast as a linear combination of the
other contrasts
Example: For a=3, we can find only 2 orthogonal contrasts. Any other
contrasts are redundant.
1 = 1 2 1 2
1 1
2 = 1 + 2 3 1 is not orthogonal to 3
2 2
4 1
3 = 1 + 2 + 3 2 is not orthogonal to 3
5 5
Recall that for the omnibus ANOVA, the df bet = a 1 . The omnibus test
combines the results of these a-1 contrasts and reports them in one
lump test
Any set of a-1 orthogonal contrasts will yield the identical result as the
omnibus test
t~
standard error( )
o Value of a contrast:
a
= c ii = c11 + c 2 2 + c 3 3 + ...+ c a a
j =1
a
= c i X i = c1 X1 + c 2 X 2 + c 3 X 3 + ...+ c a X a
j =1
t~
standard error( )
o Now we can insert the parts of the t-test into the equation:
t observed =
c X i i
ci2
MSW
ni
o Note that because the test for a contrast is calculated using the t-
distribution, you can use either a one-tailed or two-tailed test of
significance. As previously mentioned, you typically want to report the
two-tailed test of the contrast.
= (1) X 1 + (1) X 2 = X 1 X 2
12 (1) 2 1 1
Std error ( ) = MSW + = MSW +
n1 n 2 n1 n 2
X1 X 2
t= =
StdError ( ) 1 1
MSW +
n1 n2
Level of Reward
Constant Frequent Infrequent Never
(100%) (66%) (33%) (0%)
12 9 15 17
13 10 16 18
11 9 17 12
12 13 16 18
12 14 16 20
12 11 16 17
H1: Constant reward will produce faster learning than the average of the
other conditions
H2: Frequent reward will produce faster learning than the average of
infrequent or no reward
H3: Infrequent reward will produce faster learning than no reward
17.50 22
A A
A 20 23
A
trials
15.00 18
15
A
16
A A 13
12.50 14
A A
2
A A 12 21
3
10.00 A
TRIALS
10
A
8
1.00 2.00 3.00 4.00 N= 6 6 6 6
H1: Constant reward will produce faster learning than the average of
the other conditions
2 + 3 + 4 2 + 3 + 4
H 0 : 1 = H 1 : 1
3 3
1 1 1 1 1 1
1 = 1 2 3 4 c1 = 1, , ,
3 3 3 3 3 3
H2: Frequent reward will produce faster learning than the average of
infrequent or no reward
3 + 4 3 + 4
H0 : 2 = H1 : 2
2 2
1 1 1 1
2 = 2 3 4 c 2 = 0,1, ,
2 2 2 2
H 0 : 3 = 4 H1 : 3 4
3 = 3 4 c3 = (0,0,1,1)
4
1 1 1
c1 & c3 : c c = (1 * 0 ) + * 0 + * 1 + * 1 = 0
1i 3i c1 c3
j =1 3 3 3
4
1 1
c 2 & c3 : c c = (0 * 0 ) + (1 * 0 ) + * 1 + * 1 = 0
2 i 3i c 2 c3
j =1 2 2
1 1 1 1 1
1 = X 1 X 2 X 3 X 4 2 = X 2 X3 X4
3 3 3 2 2
1 1 1 1 1
= 12 (11) (16) (17) = (11) (16) (17)
3 3 3 2 2
= 2.6667 = 5.5
3 = X 3 X 4
= (16) (17)
= 1
ANOVA
Source of Variation SS df MS F P-value F crit
Between Groups 130 3 43.33333 11.1828 0.000333 3.238867
Within Groups 62 16 3.875
Total 192 19
Note: we do not care about the results of this test. We only want to
calculate MSW
1
2
1
2
1
2
12 3 3 3
Std err ( 1 ) = 3.875 + + + = 3.875 * .2667 = 1.0165
5 5 5 5
1
2
1
2
Std err ( 2 ) =
3.875 0 +
(1)
2
+ 2
+
2
= 3.875 * .30 = 1.0782
5 5 5
Std err ( 3 ) = 3.875 0 + 0 +
(1)2 + ( 1)2 = 3.875 * .40 = 1.2450
5 5
t observed =
c Xi i
ci2
MSW
ni
2.6667 5.5
1 : t observed = = 2.6237 2 : t observed = = 5.1011
1.0165 1.0782
1
3 : t observed = = 0.8032
1.2450
.05
Method 2: (The exact method): Find pobs for df = N-a and = = .025
2
for each tobs and Then compare pobs to pcrit = .05
t observed =
c X i i
Fobserved =
2
c2 ci2
MSW i MSW
ni ni
You will obtain the exact same results with t-tests or F-tests.
o If you use ONEWAY, you can directly enter the contrast coefficients to
obtain the desired contrast.
TRIALS
95% Confidence Interval for
Mean
N Mean Std. Deviation Std. Error Lower Bound Upper Bound
Constant 5 12.0000 .70711 .31623 11.1220 12.8780
Frequent 5 11.0000 2.34521 1.04881 8.0880 13.9120
Infrequent 5 16.0000 .70711 .31623 15.1220 16.8780
Never 5 17.0000 3.00000 1.34164 13.2750 20.7250
Total 20 14.0000 3.17888 .71082 12.5122 15.4878
Contrast Coefficients
REWARD
Contrast Constant Frequent Infrequent Never
1 1 -.333 -.333 -.333
2 0 1 -.5 -.5
3 0 0 1 -1
Contrast Tests
Value of
Contrast Contrast Std. Error t df Sig. (2-tailed)
TRIALS Assume equal variances 1 -2.6520 1.01628 -2.610 16 .019
2 -5.5000 1.07819 -5.101 16 .000
3 -1.0000 1.24499 -.803 16 .434
Contrast Coefficients
REWARD
Contrast Constant Frequent Infrequent Never
1 1 -.333 -.333 -.333
2 3 -1 -1 -1
3 -6 2 2 2
Contrast Tests
Value of
Contrast Contrast Std. Error t df Sig. (2-tailed)
TRIALS Assume equal variances 1 -2.6520 1.01628 -2.610 16 .019
2 -8.0000 3.04959 -2.623 16 .018
3 16.0000 6.09918 2.623 16 .018
You get more precise values if you enter the exact contrast
coefficients into SPSS, so try to avoid rounding decimal places.
Instead, multiply the coefficients by a constant so that all coefficients
are whole numbers.
In this case, the tests for contrasts 2 and 3 are exact. The test for
contrast 1 is slightly off due to rounding.
(8) 2 64
SS 1 = 2 = = 26.67
3 (1) (1) (1)
2 2
2
2.4
+ + +
5 5 5 5
(5.5) 2 30.25
SS 2 = 2 2
= = 100.83
1 1 .3
0+
(1)
+
2
2
+
2
5 5 5
(1) 2 1.0
SS 3 = = = 2.5
(1) (1)
2 2
.4
0+0+ +
5 5
SSB = 130
ANOVA
Source of Variation SS df MS F P-value F crit
Between Groups 130 3 43.33333 11.1828 0.000333 3.238867
Within Groups 62 16 3.875
Total 192 19
SSC
dfc SSC
F (1, dfw) = =
SSW MSW
dfw
26.67 100.83
1 : Fobserved = = 6.88 2 : Fobserved = = 26.021
3.875 3.875
2.50
3 : Fobserved = = 0.645
3.875
ANOVA
Source of Variation SS df MS F P-value
Between Groups 130 3 43.33333 11.1828 0.000333
1 26.67 1 26.37 6.8817 0.018446
2 100.83 1 100.83 26.021 0.000107
3 2.50 1 2.50 0.645 0.433675
Total 192 19
Note: We will shortly see they you can either perform the omnibus
test OR tests of orthogonal contrasts, but not both. Nevertheless, this
ANOVA table nicely displays the SS partition.
c1 c2 c3 c4
-1 1 0 0
-1 -1 2 0
-1 -1 -1 3
c1 c2 c3 c4
3 -1 -1 -1
0 2 -1 -1
0 0 1 -1
Simple contrasts: Each level of a factor is compared to the last level (These
contrasts are not orthogonal).
c1 c2 c3 c4
1 0 0 -1
0 1 0 -1
0 0 1 -1
c1 c2 c3 c4
1 -1 0 0
0 1 -1 0
0 0 1 -1
Relationship #1: The omnibus F test is equal to the average t 2 s from all
possible pairwise contrasts.
o A mini-proof:
SS 1 SS a1
df 1 SS 1 df a1 SS a1
For 1 : F1 = = . . . . For a1 : Fa1 = SSW
=
SSW MSW MSW
dfw dfw
SS1 + SS 2 + ...+ SS a1
F1 + F2 + ...+ Fa 1 MSW MSW MSW
F= =
a 1 a 1
SS1 + SS 2 + ...+ SS a1
MSW
=
a 1
SSB SSB
MSW a 1 MSB
= = = = Fomnibus
a 1 MSW MSW
ANOVA
Source of Variation SS df MS F P-value
Between Groups 130 3 43.33333 11.1828 0.000333
1 26.37 1 26.37 6.8052 0.019003
2 100.83 1 100.83 26.021 0.000107
3 2.50 1 2.50 0.645 0.433675
Within Groups 62 16 3.875
Total 192 19
IV
Level 1 Level 2 Level 3 Level 4
1 2 2 4
2 3 3 5
3 4 4 6
4 5 5 7
5 6 6 8
3 4 4 6
ANOVA
DV
Sum of
Squares df Mean Square F Sig.
Between Groups 23.750 3 7.917 3.167 .053
Within Groups 40.000 16 2.500
Total 63.750 19
Contrast Tests
Value of
Contrast Contrast Std. Error t df Sig. (2-tailed)
DV Assume equal variances 1 7.0000 2.44949 2.858 16 .011
YES!
o If none of the pairwise contrasts are significant, then the omnibus F test
will not be significant. But you may still find a contrast that is
significant!
IV
Level 1 Level 2 Level 3 Level 4
0 2 2 1
1 3 3 2
2 4 4 3
3 5 5 4
4 6 6 5
2 4 4 3
Value of
Contrast Contrast Std. Error t df Sig. (2-tailed)
DV 1 -2.0000 1.00000 -2.000 16 .063
2 -2.0000 1.00000 -2.000 16 .063
3 -1.0000 1.00000 -1.000 16 .332
4 .0000 1.00000 .000 16 1.000
5 1.0000 1.00000 1.000 16 .332
6 -1.0000 1.00000 -1.000 16 .332
DV
Sum of
Squares df Mean Square F Sig.
Between Groups 13.750 3 4.583 1.833 .182
Within Groups 40.000 16 2.500
Total 53.750 19
Value of
Contrast Contrast Std. Error t df Sig. (2-tailed)
DV 1 -3.0000 1.41421 -2.121 16 .050
The assumptions for contrasts are the same as those for ANOVA
o Independent samples
o Within each group, participants are independent and randomly selected
o Equal population variances in each group
o Each group is drawn from a normal population
There are two additional tools we did not use for ANOVA
o Use a contrast-specific variance so that we do not assume equality of
variances in all groups
o Try a pairwise rank-based alternative
t observed =
c X i i
ci2
MSW
ni
o The details are messy but fortunately you do not have to do the dirty
work; SPSS automatically prints out tests of contrasts with unequal
variances.
When a = 2, this test reduces exactly to the Welchs separate variance
two-sample t-test
Contrast Tests
Value of
Contrast Contrast Std. Error t df Sig. (2-tailed)
TRIALS Assume equal variances 1 -8.0000 3.04959 -2.623 16 .018
2 -5.5000 1.07819 -5.101 16 .000
3 -1.0000 1.24499 -.803 16 .434
Does not assume equal 1 -8.0000 1.97484 -4.051 11.545 .002
variances 2 -5.5000 1.25499 -4.383 7.022 .003
3 -1.0000 1.37840 -.725 4.443 .505
o Remember, this Welch correction only corrects for unequal variances and
does not correct or adjust for non-normality.
Contrast Tests
Value of
Contrast Contrast Std. Error t df Sig. (2-tailed)
RANK of TRIALS Assume equal variances 1 -1.30000 2.391129 -.544 16 .594
2 -8.80000 2.391129 -3.680 16 .002
Does not assume equal 1 -1.30000 2.230471 -.583 5.397 .584
variances 2
-8.80000 2.173707 -4.048 4.954 .010
X1 X 2 X1 X 2
g= =
MSW
SS MSW
2 =
SST + MSW
1 1 1 1
1 = 1 2 3 4 5
4 4 4 4
1 1 1 1
2 = 2 + 3 4 5
2 2 2 2
X2 + X3 + X4 + X5
X1
4 1
g= =
MSW MSW
X2 + X3 X4 + X5
2 2 2
g= =
MSW MSW
Interpretation of this g is the same as the g for two groups, but you
must be able to interpret the contrast as a comparison between two
groups.
For example, polynomial contrasts cannot be considered comparisons
between two groups. Thus, g is not appropriate for polynomial
contrasts.
Fcontrast t2
r= = 2 contrast
Fcontrast + df within t contrast + df within
8. An example
Rehabilitation Example. We have a sample of 24 male participants between
the age of 18 and 30 who have all undergone corrective knee surgery in the
past year. We would like to investigate the relationship between prior
physical fitness status (below average, average, above average) and the
number of days required for successful completion of physical therapy.
40
35.00 A
days
A
A
30 A A
30.00
A A
A
20 25.00
A
A
DAYS
A
20.00 A
10
N= 8 10 6
1.00 1.50 2.00 2.50 3.00
Below Average Average Above Average
fitness
FITNESS
DAYS
95% Confidence Interval for
Mean
N Mean Std. Deviation Std. Error Lower Bound Upper Bound
Below Average 8 38.0000 5.47723 1.93649 33.4209 42.5791
Average 10 32.0000 3.46410 1.09545 29.5219 34.4781
Above Average 6 24.0000 4.42719 1.80739 19.3540 28.6460
Total 24 32.0000 6.87782 1.40393 29.0958 34.9042
ANOVA
DAYS
Sum of
Squares df Mean Square F Sig.
Between Groups 672.000 2 336.000 16.962 .000
Within Groups 416.000 21 19.810
Total 1088.000 23
Contrast Coefficients
FITNESS
Below Above
Contrast Average Average Average
1 -.5 -.5 1
2 -1 1 0
3 0 -1 1
Contrast Tests
Value of
Contrast Contrast Std. Error t df Sig. (2-tailed)
DAYS Assume equal variances 1 -11.0000 2.10140 -5.235 21 .000
2 -6.0000 2.11119 -2.842 21 .010
3 -8.0000 2.29838 -3.481 21 .002
Does not assume equal 1 -11.0000 2.12230 -5.183 8.938 .001
variances 2 -6.0000 2.22486 -2.697 11.297 .020
3 -8.0000 2.11345 -3.785 8.696 .005
SS MSW
2 =
SST + MSW
2
SS =
ci2
n
i
(11) 2 121
SS 1 = 2 2
= = 542.80
1 1 .2229
2 + 2 + (1)
2
8 10 6
(6) 2 36
SS 2 = = = 160
( 1) 2
+
(1) 2
+
(0) 2
.225
8 10 6
(8) 2 64
SS 3 = = = 240
0+
( 1) 2
+
(1) 2
.2667
10 6
542.80 19.81
1 : 2 = = .472
1088 + 19.81
160 19.81
2 : 2 = = .127
1088 + 19.81
240 19.81
3 : 2 = = .199
1088 + 19.81
Fcontrast t2
r= = 2 contrast
Fcontrast + df within t contrast + df within
5.235 2
1 : r1 = = .75
5.235 2 + 21
2.842 2
2 : r2 = = .53
2.842 2 + 21
3.4812
3 : r2 = = .61
3.4812 + 21
Order of # of
Trend Polynomial Bends Shape
Linear 1st 0 Straight Line
Quadratic 2nd 1 U-shaped
Cubic 3rd 2 Wave
Quartic 4th 3 Wave
Etc.
Linear
Quadratic
3
3
2
2
1
1
0 0
-1 1 2 3 4 5
-1 1 2 3 4 5
-2 -2
-3 -3
Cubic
Quartic
3
10
2
1
5
0
-1 1 2 3 4 5 0
-2 1 2 3 4 5
-3 -5
Study Time
1 Minute 2 Minutes 3 Minutes 4 Minutes
2 6 5 11
3 8 7 10
1 5 9 7
2 3 4 9
0 7 9 8
4 7 8 9
2 6 7 9
c1 c2 c3 c4
Linear -3 -1 1 3
Quadratic 1 -1 -1 1
Cubic -1 3 -3 1
o To use these values, the levels of the IV need to be equally spaced and
the cell sizes must be equal
+ + +
6 6 6 6
+ + +
6 6 6 6
+ + +
6 6 6 6
When the sum of the absolute value of the contrast values is not
constant across contrasts (as with the trend contrasts), then you CAN
NOT compare contrast values. You can only compare sums of
squares and measures of effect size.
+ + +
6 6 6 6
quadratic = 1 2 3 + 4
quadratic = X1 X 2 X 3 + X 4 = 6 6 7 + 12 = 5
(5) 2
SS( quadratic ) = = 37.50
(1)2 (1) 2 (1) (1)
2 2
+ + +
6 6 6 6
cubic = 1 + 32 33 + 4
cubic = X1 + 3X 2 3X 3 + X 4 = 6 + 3(6) 3(7) + 12 = 3
(3) 2
SS( cubic ) = 2 = 2.70
(1) 2 (3) 2 (3) (1)
2
+ + +
6 6 6 6
+ + +
6 6 6 6
quadratic = 1 2 3 + 4
quadratic = X1 X 2 X 3 + X 4 = 6 6 7 + 12 = 10
(10)2
SS( quadratic ) = 2 = 150
(1)2 (1) 2 (1) (1)
2
+ + +
6 6 6 6
cubic = 1 + 32 33 + 4
cubic = X1 + 3X 2 3X 3 + X 4 = 11+ 3(6) 3(7) + 12 = 2
(2)2
SS( cubic ) = 2 = 1.20
(1) 2 (3) 2 (3) (1)
2
+ + +
6 6 6 6
20.00 A
A
17.50
A A
A
trials
15.00
A A
12.50
A A
A A
A
10.00
reward
c1 c2 c3 c4
Linear -3 -1 1 3
Quadratic 1 -1 -1 1
Cubic -1 3 -3 1
linear = 3 X 1 X 2 + X 3 + 3 X 4 quadratic = X 1 X 2 X 3 + X 4
= 3(12) (11) + (16) + 3(17) = (12) (11) (16) + (17)
= 20 =2
2
(20) (2) 2
SS( lin ) = = 100 SS( )=
2 =5
(3)2 (1) 2 (1) (3) (1) 2 (1) 2 (1) (1)
2 2 quad 2
+ + + + + +
5 5 5 5 5 5 5 5
cubic = X 1 + 3 X 2 3 X 3 + X 4
= (12) + 3(11) 3(16) + (17)
= 10
(10)2
SS( cubic ) = 2 = 25
(1) 2 (3) 2 (3) (1)
2
+ + +
5 5 5 5
Contrast Coefficients
REWARD
Contrast 1.00 2.00 3.00 4.00
1 -3 -1 1 3
2 1 -1 -1 1
3 -1 3 -3 1
Contrast Tests
Value of
Contrast Contrast Std. Error t df Sig. (2-tailed)
TRIALS Assume equal variances 1 20.0000 3.93700 5.080 16 .000
2 2.0000 1.76068 1.136 16 .273
3 -10.0000 3.93700 -2.540 16 .022
2
SS =
ci2
n
i
SS linear = 100
SS quad = 5
SS cubic = 25
ANOVA
Source of Variation SS df MS F P-value
Between Groups 130 3 43.33333 11.1828 0.000333
lin 100 1 100 25.806 0.000111
quad 5 1 5 1.290 0.272775
cubic 25 1 25 6.452 0.021837
Within Groups 62 16 3.875
Total 192 19
ANOVA
TRIALS
Sum of
Squares df Mean Square F Sig.
Between (Combined) 130.000 3 43.333 11.183 .000
Groups Linear Term Contrast 100.000 1 100.000 25.806 .000
Deviation
30.000 2 15.000 3.871 .043
Dependent
REWARD Variable
a
Polynomial Contrast TRIALS
Linear Contrast Estimate 4.472
Hypothesized Value 0
Difference (Estimate - Hypothesized)
4.472
Test Results
Level of Reward
Constant Frequent Infrequent Never
(100%) (75%) (25%) (0%)
Now we cannot use the tabled contrast values, because they require
equal spacing between intervals
A
20.00
20.00 A
17.50 A
A A
17.50
A A
A
A
A
trials
15.00
A
trials
15.00
A
A
A A
A A
12.50
A A 12.50
A A
A A
A A
A
10.00 10.00 A
A A
reward reward2
Dependent
REWARD Variable
a
Polynomial Contrast TRIALS
Linear Contrast Estimate -4.743
Hypothesized Value 0
Difference (Estimate - Hypothesized)
-4.743
Std. Error .880
Sig. .000
95% Confidence Interval Lower Bound -6.610
for Difference Upper Bound -2.877
Quadratic Contrast Estimate 1.000
Hypothesized Value 0
Difference (Estimate - Hypothesized)
1.000
Std. Error .880
Sig. .273
95% Confidence Interval Lower Bound -.866
for Difference Upper Bound 2.866
Cubic Contrast Estimate 1.581
Hypothesized Value 0
Difference (Estimate - Hypothesized)
1.581
Std. Error .880
Sig. .091
95% Confidence Interval Lower Bound -.285
for Difference Upper Bound 3.447
a. Metric = 1.000, .750, .250, .000
Remember, for a one-way design, you can obtain a test of any contrast by
using the ONEWAY command and entering the values for each contrast.
With ONEWAY method, you know exactly how the contrast is being
computed and analyzed
Example #1
o We would like to compare the effect of four drugs on body temperature.
To test these drugs, we randomly assign people to receive one of the four
drugs. After a period of time, we record each participants body
temperature.
1 = 1 A + 3 B 1 C 1 D
Report
TEMP
DRUG Mean N Std. Deviation
A 95.2000 5 .31623
B 96.1000 5 .42426
C 94.9000 5 .27386
D 95.7000 5 .61237
Total 95.4750 20 .61377
TEMP
Sum of
Squares df Mean Square F Sig.
Between Groups 4.237 3 1.412 7.740 .002
Within Groups 2.920 16 .183
Total 7.157 19
o Step 2: Test 1 = 1 A + 3 B 1 C 1 D
ANOVA
Source of Variation SS df MS F P-value
Between Groups 4.237 3 1.412 7.740 .002
1 2.6042 1 2.6042 14.2694 0.0017
Total 7.1575 19
o Step 3: Test H 0 : A = C = D
The trick is to remember that an omnibus ANOVA test m means is
equal to the simultaneous test on any set of (m-1) orthogonal contrasts
We can then combine these orthogonal contrasts in a single omnibus
F-test:
SSC1 + ... + SSCm 1
Fcomb (m 1, dfw ) = m 1
MSW
1.408 + 0.225
Fcomb (2,16) = 2 = 4.47, p = .03
.1825
ANOVA
Source of Variation SS df MS F P-value
Between Groups 4.2375 3 1.412 7.740 .002
1 2.6042 1 2.6042 14.2694 0.0017
A = C = D
1.6333 2 0.8167 4.4748 .0286
( 2 , 3 )
Within Groups 2.92 16 .1825
Total 7.1575 19
ANOVA
Source of Variation SS df MS F P-value
Between Groups 4.2375 3 1.412 7.740 .002
1 2.6042 1 2.6042 14.2694 0.0017
A = C = D 2
Total 7.1575 19
SSB = SS 1 + SS 2 + SS 3
SS 2 + SS 3 = SSB SS 1 = 4.2375 2.6042 = 1.6333
We can substitute SS2 + SS 3 into the table and compute the F-test as
we did previous (except in this case, we never identified or computed
the two additional contrasts to complete the orthogonal set).
ANOVA
Source of Variation SS df MS F P-value
Between Groups 4.2375 3 1.412 7.740 .002
1 2.6042 1 2.6042 14.2694 0.0017
A = C = D 1.6333 2 0.8167 4.4748 .0286
Total 7.1575 19
Dose of Caffeine
0mg 50mg 100mg 150mg 200mg
2 2 0 1 2
4 3 1 0 3
5 4 3 2 4
3 2 1 1 4
2 2 1 1 2
1 1 2 2 1
3 2 2 1 2
3 2 1 0 3
2 3 1 1 2
4 4 2 3 2
-1
N= 10 10 10 10 10
DOSE
ERRORS
95% Confidence Interval for
Mean
N Mean Std. Deviation Std. Error Lower Bound Upper Bound
0 mg 10 2.9000 1.19722 .37859 2.0436 3.7564
50 mg 10 2.5000 .97183 .30732 1.8048 3.1952
100 mg 10 1.4000 .84327 .26667 .7968 2.0032
150 mg 10 1.2000 .91894 .29059 .5426 1.8574
200 mg 10 2.5000 .97183 .30732 1.8048 3.1952
Total 50 2.1000 1.16496 .16475 1.7689 2.4311
o With equally spaced intervals, we can use the coefficients from the
orthogonal polynomial table. With five groups, we can test up to four
orthogonal polynomials
c1 c2 c3 c4 c5
Linear -2 -1 0 1 2
Quadratic 2 -1 -2 -1 2
Cubic -1 2 0 -2 1
Quartic 1 -4 6 -4 1
ERRORS
Sum of
Squares df Mean Square F Sig.
Between (Combined) 22.600 4 5.650 5.792 .001
Groups Linear Term Contrast 4.410 1 4.410 4.521 .039
Deviation
18.190 3 6.063 6.215 .001
Contrast Tests
Value of
Contrast Contrast Std. Error t df Sig. (2-tailed)
ERRORS Assume equal variances 1 -2.1000 .98770 -2.126 45 .039
2 4.3000 1.16866 3.679 45 .001
3 2.2000 .98770 2.227 45 .031
4 -1.0000 2.61321 -.383 45 .704
Does not assume equal 1 -2.1000 1.06301 -1.976 23.575 .060
variances 2 4.3000 1.18930 3.616 31.679 .001
3 2.2000 .97639 2.253 28.573 .032
4 -1.0000 2.37908 -.420 26.966 .678
Depende
nt
DOSE Polynomial Variable
a
Contrast ERRORS
Linear Contrast Estimate -.664
Hypothesized Value 0
Difference (Estimate - Hypothesized)
-.664
Std. Error .312
Sig. .039
95% Confidence Interval Lower Bound -1.293
for Difference Upper Bound -3.50E-02
Quadratic Contrast Estimate 1.149
Hypothesized Value 0
Difference (Estimate - Hypothesized)
1.149
Std. Error .312
Sig. .001
95% Confidence Interval Lower Bound .520
for Difference Upper Bound 1.778
Cubic Contrast Estimate .696
Hypothesized Value 0
Difference (Estimate - Hypothesized)
.696
o When the omnibus test is not significant, you still may be able to find
significant contrasts. (Remember, we demonstrated that a significant
contrast does not imply a significant omnibus F-test) Use combined
contrast tests with caution!
ANOVA Table
Source Sum of Squares df Mean Square F Sig.
Between Groups 22.600 4 5.650 5.792 .001
SS1 + ...+ SS m
m
F (m, dfw ) =
MSW
Where m a
2
SS =
ci2
n
i
c X i i
or
2
tobserved (N a) = Fobserved (1,N a) =
c i2
c2
MSW i MSW
ni ni
140
A
130.00
A
120 9 A A
A
A
A
110.00 A
100 A
A
A
anxiety
20 A A
A
A A A
A A
A A A
80 A
90.00 A
A A
A
A
21
60
ANXIETY
70.00
40 A
N= 4 5 7 5 5
.00 1.00 2.00 3.00 4.00 0.00 1.00 2.00 3.00 4.00
alcohol
ALCOHOL
UNIANOVA
anxiety BY alcohol
/CONTRAST (alcohol)=Polynomial
/PRINT=test(LMATRIX) .
We could also use ONEWAY, but then we could not see the contrast
coefficients
anb i i
=0
j= 1 i
SS linear =
(22.484)
2
2297.82
( .632)2 + ( .316)2 + (0)2 + (.316)2 + (.632)2
4 5 7 5 5
SS quadratic =
(12.481)
2
786.92
( .632)2 + ( .316)2 + (0)2 + (.316)2 + (.632)2
4 5 7 5 5
SS cubic =
(5.518)
2
148.54
( .316)2 + (.632)2 + (0)2 + ( .632)2 + (.316)2
4 5 7 5 5
SS quartic =
(8.48)
2
419.74
(.120)2 + ( .478)2 + (.717 )2 + ( .478)2 + (.120)2
4 5 7 5 5
ANOVA
ANXIETY
Sum of
Squares df Mean Square F Sig.
Between Groups 3395.065 4 848.766 9.171 .000
Within Groups 1943.550 21 92.550
Total 5338.615 25
3653.05 3395.07
One fix is to weight the cell means by their cell size. Using this weighted
approach is equivalent to adjusting the contrast coefficients by the cell size.
Group 1 2 3 4
Xj 2 4 4 2
nj 30 30 5 5
A
A
6.00 A
A A
A
A
A A
A A
A
A
8
A A
4.00 A A
A A
A A
A A
A
A A
A A
A A
6
A
dv
A
A A
A
A
A A
A A A
2.00 A
A A A
4 A
A
A A
A
A
A
A
A
A A
2 A A
A A
0.00 A
A
0
A
DV
-2
N= 30 30 5 5 1.00 2.00 3.00 4.00
1.00 2.00 3.00 4.00
group
GROUP
DV
Sum of
Squares df Mean Square F Sig.
Between (Combined) 66.468 3 22.156 8.996 .000
Groups Linear Unweighted .062 1 .062 .025 .874
Term Weighted
13.004 1 13.004 5.280 .025
Total 229.026 69
ANOVA
ANXIETY
Sum of
Squares df Mean Square F Sig.
Between Groups 3395.065 4 848.766 9.171 .000
Within Groups 1943.550 21 92.550
Total 5338.615 25
SS linear = 2297.82
SS quadratic = 786.92
SS cubic = 148.54
SS quartic = 419.74
2297.82
Flinear (1,21) = = 24.83, p < .001, r = .74
92.55
786.92
Fquad (1,21) = = 8.50, p = .008, r = .54
92.55
148.54
Fcubic (1,21) = = 1.60, p = .22, r = .27
92.55
419.74
Fquartic (1,21) = = 4.54, p = .04, r = .42
92.55
ANXIETY
Sum of
Squares df Mean Square F Sig.
Between (Combined) 3395.065 4 848.766 9.171 .000
Groups Linear Term Unweighted 2297.823 1 2297.823 24.828 .000
Weighted 2144.266 1 2144.266 23.169 .000
Deviation 1250.799 3 416.933 4.505 .014
Quadratic Unweighted 786.919 1 786.919 8.503 .008
Term Weighted 677.425 1 677.425 7.320 .013
Deviation 573.374 2 286.687 3.098 .066
Cubic Term Unweighted 148.538 1 148.538 1.605 .219
Weighted 153.632 1 153.632 1.660 .212
Deviation 419.742 1 419.742 4.535 .045
4th-order Unweighted 419.742 1 419.742 4.535 .045
Term Weighted 419.742 1 419.742 4.535 .045
Within Groups 1943.550 21 92.550
Total 5338.615 25
Grade
st rd
1 3 4th 5th 7th
0 1 3 2 2 1 3 0 3 2
1 3 0 1 0 2 2 3 0 1
0 2 2 3 1 1 3 1 2 2
2 2 2 0 0 2 1 1 1 3
0 1 1 0 1 0 2 2 3 1
A A A A
3.00
3.5
3.0
2.5 2.00 A A A A A
A A
altruism
2.0
A
1.5
A
A A A A A
1.0 1.00
.5
ALTRUISM
0.0
0.00 A A A A A
-.5
N= 10 10 10 10 10
1.00 3.00 5.00 7.00
1.00 3.00 4.00 5.00 7.00
grade
GRADE
Dependen
GRADE Polynomial t Variable
a
Contrast ALTRUISM
Linear Contrast Estimate .492
Hypothesized Value 0
Difference (Estimate - Hypothesized)
.492
Std. Error .324
Sig. .136
95% Confidence Interval Lower Bound -.160
for Difference Upper Bound 1.144
Quadratic Contrast Estimate .153
Hypothesized Value 0
Difference (Estimate - Hypothesized)
.153
Std. Error .324
Sig. .639
95% Confidence Interval Lower Bound -.500
for Difference Upper Bound .805
Cubic Contrast Estimate -.134
Hypothesized Value 0
Difference (Estimate - Hypothesized)
-.134
Std. Error .324
Sig. .681
95% Confidence Interval Lower Bound -.786
for Difference Upper Bound .518
Order 4 Contrast Estimate -.478
Hypothesized Value 0
Difference (Estimate - Hypothesized)
-.478
Std. Error .324
Sig. .147
95% Confidence Interval Lower Bound -1.130
for Difference Upper Bound .174
a. Metric = 1.000, 3.000, 4.000, 5.000, 7.000
The purpose of the study was to examine linear trends, so can I test
the linear trend and the deviation from a linear trend?
ANOVA
ALTRUISM
Sum of
Squares df Mean Square F Sig.
Between (Combined) 5.120 4 1.280 1.220 .316
Groups Linear Term Contrast 2.420 1 2.420 2.307 .136
Deviation
2.700 3 .900 .858 .470