Chapter 5 Contrasts for one-way ANOVA 4. Brand name ...andykarp/Graduate_Statistics/Graduate... · Chapter 5 Contrasts for one-way ANOVA Page 1. What is a contrast? 5-2 ... 8. An
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Page 1. What is a contrast? 5-2 2. Types of contrasts 5-5 3. Significance tests of a single contrast 5-10 4. Brand name contrasts 5-22 5. Relationships between the omnibus F and contrasts 5-24 6. Robust tests for a single contrast 5-29 7. Effect sizes for a single contrast 5-32 8. An example 5-34 Advanced topics in contrast analysis 9. Trend analysis 5-39 10. Contrasts with unequal cell size 5-52 11. A final example 5-60 Appendix 12. Simultaneous significance tests on multiple contrasts 5-64
Contrasts for one-way ANOVA 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)
• Example: You want to investigate if a college education improves SAT scores. You obtain five groups with n = 25 in each group: o High School Seniors o College Seniors
• Mathematics Majors • Chemistry Majors • English Majors • History Majors
o All participants take the SAT and scores are recorded
o The omnibus F-test examines the following hypotheses: 543210 : μμμμμ ====H
equal are s' allNot : i1 μH
o But you want to know: • Do college seniors score differently than high school seniors? • Do natural science majors score differently than humanities majors? • Do math majors score differently than chemistry majors? • Do English majors score differently than history majors?
• In general, a contrast is a set of weights that defines a specific comparison over the cell means
ψ = ciμi = c1μ1j =1
a
∑ + c2μ2 + c3μ3 + ...+ caμa
ˆ ψ = ciX i = c1X 1
j =1
a
∑ + c2 X 2 + c3 X 3 + ...+ ca X a
o Where
(μ1,μ2,μ3, ...,μa ) are the population means for each group (X 1, X 2,X 3, ...,X a ) are the observed means for each group (c1,c2,c3,...,ca )are weights/contrast coefficients
with cii=1
a
∑ = 0
• A contrast is a linear combination of cell means
o Do college seniors score differently than high school seniors?
4: 5432
10μμμμ
μ+++
=H or H0 : μ1 −μ2 + μ3 + μ4 + μ5
4= 0
543211 41
41
41
41 μμμμμψ −−−−= ⎟
⎠⎞
⎜⎝⎛ −−−−=
41,
41,
41,
41,1c
o Do natural science majors score differently than humanities majors?
22: 5432
0μμμμ +
=+
H or H0 :μ2 + μ3
2−
μ4 + μ5
2= 0
54322 21
21
21
21 μμμμψ −−+= ⎟
⎠⎞
⎜⎝⎛ −−=
21,
21,
21,
21,0c
o Do math majors score differently than chemistry majors?
o Sometimes called non-redundant contrasts o Orthogonality may be best understood through a counter-example o Suppose you want to test three contrasts:
• Do math majors score differently than high school seniors? 121 μμψ −= ( )0,0,0,1,1−=c
• Do chemistry majors score differently than high school seniors? 132 μμψ −= ( )0,0,1,0,1−=c
• Do math majors score differently than chemistry majors? 323 μμψ −= ( )0,0,1,1,0 −=c
• If I know 2ψ and 3ψ then I can determine the value of 1ψ • 1ψ , 2ψ , and 3ψ are redundant or non-orthogonal contrasts
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)
• If a set of contrasts are orthogonal then the contrast coefficients are
not correlated with each other
• Two contrasts are orthogonal if the angle between them in a-space is a right angle
o A set of contrasts is orthogonal if each contrast is orthogonal to all other
contrasts in the set You can check that:
( )0,0,1,11 −=c 21 cc ⊥ ( )0,2,1,12 −=c 32 cc ⊥ ( )3,1,1,13 −=c 31 cc ⊥
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.
211 μμψ −= 1ψ ⊥ 2ψ
3212 21
21 μμμψ −+= 1ψ is not orthogonal to 3ψ
3213 51
54 μμμψ ++−= 2ψ is not orthogonal to 3ψ
We can write 3ψ in terms of 1ψ and 2ψ
213 51
109 ψψψ −−=
( ) ⎟⎠⎞
⎜⎝⎛ −+−−−= 32121 2
121
51
109 μμμμμ
⎟⎠⎞
⎜⎝⎛ +−−+⎟
⎠⎞
⎜⎝⎛ +−= 32121 5
1101
101
109
109 μμμμμ
321 51
54 μμμ ++−=
• In general, you will not need to show how a contrast may be
calculated from a set of orthogonal contrasts. It is sufficient to know that if you have more than a-1 contrasts, there must be at least one contrast you can write as a linear combination of the other contrasts.
errorstandardestimatedparameter population of estimate~t
)ˆerror( standard ˆ
~ψ
ψt
o Now we can insert the parts of the t-test into the equation:
∑
∑=
i
i
iiobserved
nc
MSW
Xct
2
with degrees of freedom aNdf w −==
o To determine the level of significance, you can:
• Look up tcrit for df = N-a and the appropriate α • Or preferably, compare pobs with pcrit
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.
o Multiplying the coefficients by a constant will not change the results of the significance test on that contrast. • If you multiply the values of a contrast by any constant (positive or
negative), you will obtain the identical test statistic and p-value in your analysis.
• The value of the contrast, the standard error, and the size of the CIs will shrink or expand by a factor of the constant used, but key features (i.e., p-values and whether or not the CIs overlap) remain the same.
• 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.
o Once we have calculated the SSC, then we can compute an F-test directly:
MSWSSC
dfwSSW
dfcSSC
dfwF ==),1(
1ψ̂ : Fobserved =26.673.875
= 6.88 2ψ̂ : 021.26875.3
83.100==observedF
3ψ̂ : 645.0875.350.2
==observedF
o ANOVA table for contrasts
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 Within Groups 62 16 3.875 Total 192 19
• In this ANOVA table, we show that SSC partitions SSB. • But this relationship only holds for sets of orthogonal contrasts • In general, you should only construct an ANOVA table for a set of a-1
orthogonal contrasts
• Note: We will shortly see they you should either perform the omnibus test OR tests of orthogonal contrasts, but not both. Nevertheless, this ANOVA table nicely displays the SS partition.
o Consequence: If the omnibus F test is significant, then at least one contrast is significant.
o In the learning example:
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
• Suppose none of the pairwise contrasts are significant. Is it possible to have
a significant contrast?
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!
• 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
• Tests of contrasts are not robust to heterogeneity of variances, even with
equal n
• We can use our standard ANOVA techniques to test these assumptions. Presumably, by the time you are testing contrasts, you have already identified troublesome aspects about your data. But once you have identified the problems what can you do? o In general, the same “fixes” for ANOVA work for contrasts o A sensitivity analysis can be used to investigate the impact of outliers o Transformations can be used for non-normality or heterogeneous
variances (Ideally this transformation would be theoretically determined).
• 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
• Use a contrast-specific variance o In the standard hypothesis test of a contrast, the denominator uses the
MSW, a pooled variance estimate
∑
∑=
i
i
iiobserved
nc
MSW
Xct
2
o What we would like to do is compute a new standard error of ψ̂ that does
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 Welch’s separate variance
two-sample t-test o Let’s return to the learning example and pretend that we found
heterogeneous variance. Thus, to test our original hypotheses in the data (see p 5-12), we need to use the modified test for contrast:
o Pair-wise tests can be conducted using the Mann-Whitney U test (or an ANOVA on the ranked data).
o However, complex comparisons should be avoided! Because ranked data are ordinal data, we should not average (or take any linear combination) across groups.
o A comparison of Mann-Whitney U pairwise contrasts with ANOVA by
Approach Contrast Mann-Whitney U ANOVA by Ranks 21 μμ = z = -0.638, p = .523 t(16) = -0.544, p = .594 32 μμ = z = -2.652, p = .008 t(16) = -3.680, p = .002
o A rank modification of ANOVA is easy to use but: • This approach is often not valid for multi-factor ANOVA. • This approach is likely to be trouble for complex comparisons. • Remember that the conclusions you draw are on the ranks, and not on
the observed values! 7. Effect sizes for a single contrast
• For pairwise contrasts, you can use Cohen’s d:
MSW
XXXXd 2121
ˆ−
=−
=σ
• In the general case there are several options
o Use omega squared ( 2ω )
MSWSSTMSWSS
+−
=ψωˆˆ 2
2ω = .01 small effect size 2ω = .06 medium effect size 2ω = .15 large effect size
2ω has a fairly easy interpretation: it is the percentage of the variance
in the dependent variable (in the population) that is accounted for by the contrast
• r is interpretable as the (partial) correlation between the group means and the contrast values, controlling for non-contrast variability.
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.
o We need to convert the hypotheses to contrast coefficients
• Above average participants complete therapy faster than other groups
2: 21
30μμ
μ+
=H
3211 21
21 μμμψ +−−= ⎟
⎠⎞
⎜⎝⎛ −−= 1,
21,
21c
• Average participants complete therapy faster than below average
participants 120 : μμ =H
212 μμψ +−= ( )0,1,1−=c
• Average participants complete therapy slower than above average participants
320 : μμ =H
323 μμψ +−= ( )1,1,0 −=c
o Are these three contrasts an orthogonal set?
• With 3 groups, we can only have 2 orthogonal contrasts If we had equal sample sizes, then 1ψ ⊥ 2ψ With unequal n we do not have an orthogonal set of contrasts
• OR a d measure of effect size for each contrast:
MSWd
ψ̂= where ai∑ = 2
1ψ̂ : 47.281.19
111 ==d
2ψ̂ : 35.181.19
62 ==d
3ψ̂ : 79.181.19
83 ==d
o Report the results
1ψ̂ : 47.2,01.,24.5)21( =<−= dpt
2ψ̂ : 35.1,01.,84.2)21( ==−= dpt
3ψ̂ : 79.1,01.,48.3)21( =<−= dpt
• In your results section, you need to say in English (not in statistics or symbols) what each contrast is testing
• In general, it is not necessary to report the value of the contrast or the contrast coefficients used
. . . A contrast revealed that above average individuals recovered faster than all other individuals, 47.2,01.,24.5)21( =<−= dpt . Pairwise tests also revealed that average individuals completed therapy faster than below average individuals, 35.1,01.,84.2)21( ==−= dpt , and that above average individuals completed therapy faster than average participants,
o These contrasts are orthogonal (when ns are equal), so it is possible to have any combination of effects (or lack of effects)
o Because the sets of weights are not equally scaled, you cannot compare the strength of effects simply by inspecting the value of the contrast.
o Some people place an additional constraint on the contrast weights:
cii=1
a
∑ = 2
• 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.
• You can also directly ask for polynomial contrasts in SPSS
o Method 1: ONEWAY
ONEWAY trials BY reward /POLYNOMIAL= 3.
• After polynomial, enter the highest degree polynomial you wish to
test.
o Advantages of the ONEWAY method for polynomial contrasts:
• It utilizes the easiest oneway ANOVA command • It gives you the sums of squares of the contrast • It uses the spacing of the IV in the data (Be careful!) • It gives you the deviation test.
o Disadvantages of the ONEWAY method for polynomial contrasts:
• You can not see the value of the contrast or the contrast coefficients
• SPSS calculates a set of orthogonal trend contrasts, based on the spacing you provide. Here they are:
o Advantages of the UNIANOVA method:
• It is the only way SPSS gives you confidence intervals for a contrast (But remember, the width of CIs depends on the contrast values)
• It allows you to deal with unequally spaced intervals (It assumes equal spacing unless you tell it otherwise; no matter how you have the data coded!)
• It will print the contrast values SPSS uses
o Disadvantages of the UNIANOVA method: • It does not print out a test statistic or the degrees of freedom of the
test!?!
• 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
• Our formulas for computing the value of a contrast, the sums of squares of a contrast, and the significance of a contrast can all handle designs with unequal n in each cell
ˆ ψ = ciX i = c1X 1
j =1
a
∑ + c2 X 2 + c3 X 3 + ...+ ca X a
SSψ̂ = ∑
i
i
nc 2
2 ψ̂
tobserved (N − a) =ciX i∑
MSW ci2
ni∑
or Fobserved (1,N − a) =ˆ ψ 2
MSWci
2
ni∑
• The problem is in the orthogonality of contrasts with unequal n
1ψ = (a1,a2,a3, ...,aa ) 2ψ = (b1,b2,b3,...,ba )
o Two contrasts are orthogonal for unequal n if
aibi
nij=1
a
∑ = 0 or a1b1
n1
+a2b2
n2
+ ...+aaba
na
= 0
o All of our standard orthogonal contrasts will no longer be orthogonal
It was of interest to determine the effects of the ingestion of alcohol on anxiety level. Five groups of 50 year-old adults were administered between 0 and 4 ounces of pure alcohol per day over a one-month period. At the end of the experiment, their anxiety scores were measured with a well-known Anxiety scale.
o According to the unweighted analysis, there is no linear trend This analysis treats all group means equally The Contrast SS do not partition the SSB
o According to the weighted analysis, there is a linear trend This analysis gives most of the weight to group 1 and group 2 The Contrast SS do partition the SSB exactly
o Which method is better?
• If your goal is to compare group means, then you should conduct the unweighted analysis.
This case holds most of the time! Remember, there is nothing wrong with testing non-orthogonal
contrasts But you cannot construct combined contrasts tests
• If the inequality in the cell sizes reflects a meaningful difference in
group sizes and you want to reflect those differences in your analysis, then a weighted means approach may be appropriate.
You must have a representative sample Your main goal would NOT be to compare groups If you think a weighted analysis may be appropriate, then you
should read more about proper interpretation of this analysis. (see Maxwell & Delaney, 1990)
• Our hand calculations exactly match the unweighted analysis
o Remember, we originally wanted to test for linear, quadratic, and all higher order terms. Because of the non-orthogonality of the contrasts, we cannot compute a deviation from linearity and quadratic trends test. We must report a test on each contrast individually.
o We conclude that there is a linear, a quadratic and a 4th order effect of
alcohol on anxiety • This 4th order effect is going to be a pain to explain in your results and
• In an investigation of altruism in children, investigators examined children in 1st, 3rd, 4th, 5th, and 7th grades. The children were given a generosity scale. Below are the data collected:
APPENDIX 12. Simultaneous significance tests on multiple orthogonal contrasts
• Sometimes you may wish to test the significance of several contrasts in a single omnibus test
• 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 participant’s body temperature.
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 Within Groups 2.92 16 .1825 Total 7.1575 19
o Step 3: Test DCAH μμμ ==:0 • 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
• We need to choose any 2 contrasts so long as we have an orthogonal set of three contrasts (including the contrast associated with the first hypothesis):
)1,1,3,1(:1 −−−c )2,1,0,1(:2 −−c
)0,1,0,1(:3 −c • This set will work because all three contrasts are orthogonal. Now,
let’s compute the simultaneous F-test of these two contrasts.
3.1)5.97(2)9.94(10)2.95(1ˆ 2 =+−+−=ψ
SS 2ψ̂ = ( ) ( ) ( ) ( )
52
51
50
51
)3.1(2222
2
+−
++−
= 2.169.1 = 1.408
3.0)5.97(0)9.94(10)2.95(1ˆ 3 −=+++−=ψ
SS 3ψ̂ = ( ) ( ) ( ) ( )
50
51
50
51
)3.0(2222
2
+++−
− = 4.09. = .225
Fcomb (m −1,dfw) =
SSC1 + ...+ SSCm −1
m −1MSW
Fcomb (2,16) =
1.408 + 0.2252
.1825= 4.47, p = .03
We reject 0H and conclude that DCA and μμμ , , are not all equal
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 DCA μμμ == ( )32 ,ψψ
o Note: We also could have computed the test of μA = μC = μD without directly computing the two orthogonal contrasts: • If we knew the combined sums of squares of these two contrasts then
we could fill in the remainder of the ANOVA table. • But we do know the combined sums of squares for the remaining two
contrasts (so long as all the contrasts are orthogonal)!
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 DCA μμμ ==
• We can substitute SSψ2 + 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 DCA μμμ ==
o We want to examine the effect of caffeine on cognitive performance and attention. Participants are randomly assigned to one of 5 dosages of caffeine. In a subsequent proofreading task, we count the number of errors.
N Mean Std. Deviation Std. Error Lower Bound Upper Bound
95% Confidence Interval forMean
o We would like to test if there is a linear or a quadratic trend. We are not
really interested in any higher order trends
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
• Under “Linear Term” CONTRAST is the test for the linear contrast: F(1,45) = 4.52, p = .039 DEVIATION is the combined test for the quadratic, cubic, and
quartic contrasts: F(3,45) = 6.62, p = .001
• Under “Quadratic Term” CONTRAST is the test for the quadratic contrast:
F(1,45) = 13.54, p = .001 DEVIATION is the combined test for the cubic and quartic contrasts
F(2,45) = 2.55, p = .089
• Is it safe to report that there are no higher order trends?
• We conclude there are significant linear, quadratic and cubic trends.
o Wait a minute . . . Didn’t we just conclude there were no significant trends higher than quadratic!?!
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
Linear Term 4.410 1
4.410
4.521 .039
Quadratic Term 13.207 1 13.207 13.538 .001Cubic Term 4.840 1 4.840 4.961 .0314th-order Term
.143 1 .143 .146 .704
Within Groups 43.900 45 .976 Total 66.500 49
• In general, to test m orthogonal contrasts simultaneously