Pre planned comparisonsSeptember29.doc

ST 524
Treatment Comparison: Contrasts
NCSU - Fall 2008
Pre planned comparisons among treatment means – Contrasts
Decision about comparisons is made before collecting data.
Comparisons are based on the structure of the treatment factor.
Contrast is a linear combination of treatment means, where the sum of coefficients equal 0:
Orthogonal Contrasts
Example 9.2 (STD book) present data for the oil content of Redwing flaxseed in percentage. Experimental design
follows a randomized complete block design with 4 blocks and 6 treatments. Plots vere inoculated with spores
suspensions of Septoria linicola, which causes pasmo in flax. Treatments are stage of the plant when receiving the
inoculation.
Linear Model
Y  Xβ  e
F

, eij ~ iidN 0,  e2

Yij     i   j  eij ,
Analysis of variance table (Decomposition of Total Sum of Squares for Y)
The GLM Procedure
Class Level Information
Class
block
treat
Levels
4
6
Values
1 2 3 4
Early_Bloom Full_Bloom Full_Bloom_P Ripening Seedling uninoculated
Number of Observations Read
Number of Observations Used
24
24
The GLM Procedure
Dependent Variable: y
DF
Sum of
Squares
Mean Square
F Value
Pr > F
Model
8
34.79333333
4.34916667
3.31
0.0219
Error
15
19.71625000
1.31441667
Corrected Total
23
54.50958333
Source
R-Square
Coeff Var
Root MSE
y Mean
0.638298
3.226870
1.146480
35.52917
Source
SS  Block |  
SS Treat | Block ,  
SS  Block | Treat ,  
SS Treat | Block ,  
DF
Type I SS
Mean Square
F Value
Pr > F
3
5
3.14125000
31.65208333
1.04708333
6.33041667
0.80
4.82
0.5147
0.0080
DF
Type III SS
Mean Square
F Value
Pr > F
3
5
3.14125000
31.65208333
1.04708333
6.33041667
0.80
4.82
0.5147
0.0080
block
treat
Source
block
treat
Least Squares Means: i.     i  
Least Squares Mean for Treatment - Treatment LSMEAN
Treatment
T1
T2
T3
T4
T5
T6
Thursday September 25, 2008
treat
Early_Bloom
Full_Bloom
Full_Bloom_P
Ripening
Seedling
uninoculated
y LSMEAN
Error
Pr > |t|
34.3000000
34.0000000
36.7000000
36.0500000
35.1000000
37.0250000
0.5732401
0.5732401
0.5732401
0.5732401
0.5732401
0.5732401
<.0001
<.0001
<.0001
<.0001
<.0001
<.0001
1
ST 524
Treatment Comparison: Contrasts
NCSU - Fall 2008
Average for each treatment level over the block effects
 37.2458 
 0.4833


 0.6500 


 0.2500 

 37.2458  1 4   0.4833  0.6500  0.2500  0    2.725    34.3 
ˆ

1
1
4
1
4
1
4
1
4
1
0
0
0
0
0
0
 1.  

 ˆ   1 1 4 1 4 1 4 1 4 0 1 0 0 0 0   2.725   37.2458  1 4 0.4833  0.6500  0.2500  0  3.025    34.0 
 
 
 
2.

 
  




 37.025 
37.2458  1 4  0.4833  0.6500  0.2500  0   0
 ˆ 6.  1 1 4 1 4 1 4 1 4 0 0 0 0 0 1   3.025  
 0.3250 
 0.9750 


 1.9250 


 0 
Treatment effect is significant. We reject null hypothesis of equality of treatment effects. Want to analyze how the stage of plant
growth (Treatments) affects the response, content of oil.
Contrast 1 “ Seedling vs Early Bloom”
Compare T5 vs T1
1.     1  
1.  6.      1         6      1   6
6.     6  
Contrast 2 “Early Bloom vs Full Bloom”
Compare Early Bloom T1 vs Full Bloom T2
1.     1  
2.  1.      2         1      2   1
2.     2  
Contrast 3 “Full Bloom vs Full Bloom (1/100)”
Compare Full Bloom T2 vs Full Bloom (1/100) T3
3.     3  
3.  2.      3         2      3   2
2.     2  
Contrast 4 “Full Bloom vs Ripening”
Compare Full Bloom treatments, T2 and T3, vs Ripening T4
4.     4  
Full Bloom 


4.   Full Bloom      4       
2  3
2
 2 3
2

  
2
      3   
2
 

   4  2 3
2


 2 3
2

Contrast 5 “Uninoculated vs treated”
Compare Uninoculated T1 vs treated average of T1, T2,T3, T4, T5
6.     6  
treated
treated . 
1  2  3  4  5
1   2   3   4   5
5



















 6.     1 2 3 4 5         6     1 2 3 4 5   6
5
5


Thursday September 25, 2008
5


2
ST 524
Treatment Comparison: Contrasts
 Cˆ1.  0 0 0 0 0 1 0 0
  
Cˆ 2.   0 0 0 0 0 1 1 0
 ˆ  0 0 0 0 0 0 1 1
C3.  
Cˆ 4.  0 0 0 0 0 0 1 2
  
Cˆ 5.   0 0 0 0 0 1 5 1 5
  
  
NCSU - Fall 2008
 37.2458 
 0.4833


 0.6500 


 0.2500 
0 1 0   0    2.725    1.9250    0.80 

 

0 0 0   2.725      2.725    3.025     0.30 
0 0 0   3.025     3.025    0.3250    2.7 


 0.3250 
 0.9750 


 1.9250 


 0 
 37.2458 
 0.4833


 0.6500 


 0.2500 
1 2 1
0 0   0      3.025    0.325   2   0.975    0.70 
 

 

1 5 1 5 1 5 1   2.725   
  2.725    3.025 
   1.795
 
  3.025  

 

 
 0.3250 
 0.9750 


1.9250 


 0 
Standard error for contrasts
 
s.e  Cˆ   var  Cˆ   0.6572083  0.810684
ˆ  ˆ  Error MS 
1 1  1.31441667 
1 1 

var  Cˆ   var  ˆ 
1    
1     0.4929063

2
r
2
2
4
2
2 





Error MS
1.31441667
var Cˆ1  var  ˆ1.  ˆ 6.   2
2
 0.6572083
r
4
1
1
2.
4
2
3.
4.
2
2
 
 
ˆ

var  Cˆ   var  ˆ 

2
2
2
s.e Cˆ 4  var Cˆ 4  0.4929063  0.702073
1.
5
6.
 
 ˆ 2.  ˆ 3.  ˆ 4.  ˆ 5.  Error MS  2
1  1.31441667 
1
1  5 2  
1    0.394325

5
r
5 
4
5



 
s.e Cˆ 5  var Cˆ5  0.394325  0.727953
To test hypothesis
tcalc 
H o : C1  0
H1 : C1  0
we can use t-test
ˆ1.  ˆ 6.
Cˆ1  0
0.8


 0.9868
ˆ
ˆ
ˆ
s
.
e



0.810684


s.e C1
1.
6.
 
2
Fcalc  tcalc
  0.9868  0.9738
2
Fcalc 
 
SS Cˆ1 1
Error MS

r  ˆ 6  ˆ1  1 12  12 
2

Error MS
  r  ˆ
tcalc is distributed as a t r.v with dfError
Calculated F for contrast C1 in Contrast statement is the
squared value for t statistic in the Estimate statement.
 ˆ1  2
Error MS , which is distributed as an F r.v. with 1, dfError=15
2
6
4  0.8  2
 0.9738
1.314441667
p-value= 0.3394 Do not Reject Ho
2
Fcalc 
Test of hypothesis
H o : C4  0
H 1 : C4  0
Thursday September 25, 2008
3
ST 524
Treatment Comparison: Contrasts
tcalc 
NCSU - Fall 2008
ˆ 4.   ˆ 2.  ˆ 3.  2
Cˆ 4  0
0.7


 0.9970
ˆ
s.e  ˆ 4.   ˆ 2.  ˆ 3.  2  0.7021
s.e C4
 
2
Fcalc  tcalc
  0.9970   0.9940
2
Fcalc
2
1 

2
r  ˆ 4   ˆ 2  ˆ 3  2  1 12  2 2  
2   r  ˆ 4   ˆ 2  ˆ 3  2  1.5 , which is distributed as an F r.v. with 1, dfError=15





Error MS
Error MS
Error MS
 
SS Cˆ 4 1
4  0.7  1.5
 0.9904
1.314441667
p-value= 0.3346 Do not Reject Ho
2
Fcalc 
OUTPUT from PROC GLM
Contrast
Seedling vs Early Bloom
Early Bloom vs Full Bloom
Full Bloom vs Full Bloom (1/100)
Full Bloom vs Ripening
uninoculated vs rest
DF
Contrast SS
Mean Square
F Value
Pr > F
1
1
1
1
1
1.28000000
0.18000000
14.58000000
1.30666667
10.74008333
1.28000000
0.18000000
14.58000000
1.30666667
10.74008333
0.97
0.14
11.09
0.99
8.17
0.3394
0.7165
0.0046
0.3346
0.0120
Estimate
Standard
Error
t Value
Pr > |t|
-0.80000000
-0.30000000
2.70000000
0.70000000
-1.79500000
0.81068387
0.81068387
0.81068387
0.70207282
0.62795302
-0.99
-0.37
3.33
1.00
-2.86
0.3394
0.7165
0.0046
0.3346
0.0120
Parameter
Seedling vs Early Bloom
Early Bloom vs Full Bloom
Full Bloom vs Full Bloom (1/100)
Full Bloom (1/100) Ripening
uninoculated vs rest
Output from PROC MIXED
Example 9.2 STD
RCBD Block and Treat fixed effect
The Mixed Procedure
Model Information
Data Set
Dependent Variable
Covariance Structure
Estimation Method
Residual Variance Method
Fixed Effects SE Method
Degrees of Freedom Method
WORK.REDWING
y
Diagonal
REML
Profile
Model-Based
Residual
Class Level Information
Class
Levels
block
treat
4
6
Values
1 2 3 4
Early_Bloom Full_Bloom
Full_Bloom_P Ripening Seedling
uninoculated
Dimensions
Covariance Parameters
Columns in X
Columns in Z
Subjects
Max Obs Per Subject
1
11
0
1
24
Number of Observations
Thursday September 25, 2008
4
ST 524
Treatment Comparison: Contrasts
NCSU - Fall 2008
Number of Observations Read
Number of Observations Used
Number of Observations Not Used
24
24
0
Covariance Parameter
Estimates
Cov Parm
Residual
Estimate
1.3144
Fit Statistics
-2 Res Log Likelihood
AIC (smaller is better)
AICC (smaller is better)
BIC (smaller is better)
59.0
61.0
61.3
61.7
Solution for Fixed Effects
Effect
treat
Intercept
treat
treat
treat
treat
treat
treat
block
block
block
block
block
Estimate
Standard
Error
DF
t Value
Pr > |t|
37.2458
-2.7250
-3.0250
-0.3250
-0.9750
-1.9250
0
-0.4833
-0.6500
0.2500
0
0.7021
0.8107
0.8107
0.8107
0.8107
0.8107
.
0.6619
0.6619
0.6619
.
15
15
15
15
15
15
.
15
15
15
.
53.05
-3.36
-3.73
-0.40
-1.20
-2.37
.
-0.73
-0.98
0.38
.
<.0001
0.0043
0.0020
0.6941
0.2477
0.0313
.
0.4765
0.3417
0.7110
.
Early_Bloom
Full_Bloom
Full_Bloom_P
Ripening
Seedling
uninoculated
1
2
3
4
Type 3 Tests of Fixed Effects
Effect
treat
block
Num
DF
Den
DF
F Value
Pr > F
5
3
15
15
4.82
0.80
0.0080
0.5147
Estimates
Label
Seedling vs Early Bloom
Early Bloom vs Full Bloom
Full Bloom vs Full Bloom (1/100)
Full Bloom (1/100) Ripening
uninoculated vs rest
Estimate
Standard
Error
DF
t Value
Pr > |t|
-0.8000
-0.3000
2.7000
0.7000
-1.7950
0.8107
0.8107
0.8107
0.7021
0.6280
15
15
15
15
15
-0.99
-0.37
3.33
1.00
-2.86
0.3394
0.7165
0.0046
0.3346
0.0120
Contrasts
Label
Seedling vs Early Bloom
Early Bloom vs Full Bloom
Full Bloom vs Full Bloom (1/100)
Full Bloom vs Ripening
uninoculated vs rest
Thursday September 25, 2008
Num
DF
Den
DF
F Value
Pr > F
1
1
1
1
1
15
15
15
15
15
0.97
0.14
11.09
0.99
8.17
0.3394
0.7165
0.0046
0.3346
0.0120
5
ST 524
Treatment Comparison: Contrasts
NCSU - Fall 2008
Orthogonal Contrasts
 Treatment SS can be presented as the sum of t-1 orthogonal contrasts, in general.
 Differences among treatments may be studied by a meaningful set of t-1 orthogonal contrasts.
 Orthogonal Contrasts: Product of their coefficients add to zero. Contrasts are uncorrelated
Mean
OC1
OC2
OC3
OC4
OC5
Early
Bloom
34.300
1
-1
1
-2
0
Full
Bloom
34.000
1
-1
1
1
-1
Full
Bloom P
36.700
1
-1
1
1
1
Ripening
Seedling
uninoculated
36.050
1
3
1
0
0
35.10
1
0
-4
0
0
37.025
-5
0
0
0
0
estimate "uninoculated vs rest"
estimate "ripening vs Blooming"
estimate "Seedling vs rest trt "
estimate "Early Bloom vs Full Bloom"
estimate " Full Bloom vs Full Bloom (1/100)"
treat 1 1 1
treat -1 -1 -1
treat 1 1 1
treat -2 1 1
treat 0 -1 1
Parameter
Estimate
uninoculated vs rest
DIVISOR
Ĉ
5
3
4
2
1
-1.7950
1.0500
0.1625
1.0500
2.7000
-1.7950
1 1 -5/divisor=5;
3 0 0/divisor=3;
1 -4 0/divisor=4;
0 0 0/divisor=2;
0 0 0/divisor=1;
Standard Error
t Value
Pr > |t|
-1.79500000
0.62795302
-2.86
0.0120
ripening vs Blooming
1.05000000
0.66192061
1.59
0.1335
Seedling vs rest trt
0.16250000
0.64090187
0.25
0.8033
Early Bloom vs Full Bloom
1.05000000
0.70207282
1.50
0.1555
Full Bloom vs Full Bloom (1/100)
2.70000000
0.81068387
3.33
0.0046
VAR_OCNTRT
Thursday September 25, 2008
0.4470467
0
0
0
0
0
0.4967186
0
0
0
0
0
0.4656737
0
0
0
0
0
0.5588084
0
0
0
0
0
0.7450778
EST_OCNTRT
SE_OCNTRT
-1.795
0.6686155
1.05
0.7047826
0.1625
0.6824029
1.05
0.7475349
2.7
0.8631789
6
ST 524
Treatment Comparison: Contrasts
NCSU - Fall 2008
Contrast Unequal Number of repetitions
Example 9.2 STD missing observations
RCBD Block and Treat fixed effect
The GLM Procedure
Dependent Variable: y
Source
DF
Sum of Squares
Mean Square
F Value
Pr > F
Model
8
28.06797619
3.50849702
2.35
0.0820
Error
13
19.37202381
1.49015568
Corrected Total
21
47.44000000
R-Square
Coeff Var
Root MSE
y Mean
0.591652
3.438646
1.220719
35.50000
Source
DF
Type III SS
Mean Square
F Value
Pr > F
block
3
2.87797619
0.95932540
0.64
0.6005
treat
5
27.07630952
5.41526190
3.63
0.0282
LSMEANS
treat
y LSMEAN
Standard Error
Pr > |t|
Early_Bloom
34.3000000
0.6103597
<.0001
Full_Bloom
33.8330357
0.7226477
<.0001
Full_Bloom_P
36.7000000
0.6103597
<.0001
Ripening
36.0500000
0.6103597
<.0001
Seedling
35.1000000
0.6103597
<.0001
uninoculated
36.9544643
0.7226477
<.0001
Coefficients for Orthogonal Contrasts
Mean
OC1
OC2
OC3
OC4
OC5
Early
Bloom
34.300
1
-1
1
-2
0
Full
Bloom
33.8330
1
-1
1
1
-1
Full
Bloom P
36.700
1
-1
1
1
1
Ripening
Seedling
uninoculated
36.050
1
3
1
0
0
35.10
1
0
-4
0
0
36.9545
-5
0
0
0
0
estimate "uninoculated vs rest"
estimate "ripening vs Blooming"
estimate "Seedling vs rest trt "
estimate "Early Bloom vs Full Bloom"
estimate " Full Bloom vs Full Bloom (1/100)"
Thursday September 25, 2008
treat 1 1 1
treat -1 -1 -1
treat 1 1 1
treat -2 1 1
treat 0 -1 1
DIVISOR
Ĉ
5
3
4
2
1
-1.7579
1.1056
0.1208
0.9665
2.8670
1 1 -5/divisor=5;
3 0 0/divisor=3;
1 -4 0/divisor=4;
0 0 0/divisor=2;
0 0 0/divisor=1;
7
ST 524
Treatment Comparison: Contrasts
NCSU - Fall 2008
Parameter
Estimate
Standard Error
t Value
Pr > |t|
Seedling vs Early Bloom
-0.8000000
0.86317891
-0.93
0.3709
Early Bloom vs Full Bloom
-0.4669643
0.94591683
-0.49
0.6298
Full Bloom vs Full Bloom (1/100)
2.8669643
0.94591683
3.03
0.0096
Full Bloom (1/100) Ripening
0.7834821
0.77215839
1.01
0.3288
uninoculated vs rest
-1.7578571
0.77891350
-2.26
0.0419
uninoculated vs rest
-1.7578571
0.77891350
-2.26
0.0419
ripening vs Blooming
1.1056548
0.71648431
1.54
0.1468
Seedling vs rest trt
0.1207589
0.68922326
0.18
0.8636
Early Bloom vs Full Bloom
0.9665179
0.77215839
1.25
0.2327
Full Bloom vs Full Bloom (1/100)
2.8669643
0.94591683
3.03
0.0096
Calculate Standard Error for contrasts
BETAV
37.214881
-0.483333
-0.76131
0.2029762
0
-2.654464
-3.121429
-0.254464
-0.904464
-1.854464
0
Matrix
(XTX)-1
COVXTX
COL1
COL2
COL3
COL4
ROW1
0.4494048
-0.166667
-0.181548
-0.110119
ROW2
-0.166667
0.3333333
0.1666667
ROW3
-0.181548
0.1666667
0.3779762
Thursday September 25, 2008
COL5
COL6
COL7
COL8
COL9
COL10
0
-0.334821
-0.357143
-0.334821
-0.334821
-0.334821
0
0.1666667
0
0
0
0
0
0
0
0.1636905
0
0.0044643
0.0714286
0.0044643
0.0044643
0.0044643
0
8
COL11
ST 524
Treatment Comparison: Contrasts
NCSU - Fall 2008
COVXTX
COL1
COL2
COL3
COL4
COL5
COL6
COL7
COL8
COL9
COL10
ROW4
-0.110119
0.1666667
0.1636905
0.3779762
ROW5
0
0
0
ROW6
-0.334821
0
ROW7
-0.357143
ROW8
0
-0.066964
-0.071429
-0.066964
-0.066964
-0.066964
0
0
0
0
0
0
0
0
0
0.0044643
-0.066964
0
0.6004464
0.3571429
0.3504464
0.3504464
0.3504464
0
0
0.0714286
-0.071429
0
0.3571429
0.7142857
0.3571429
0.3571429
0.3571429
0
-0.334821
0
0.0044643
-0.066964
0
0.3504464
0.3571429
0.6004464
0.3504464
0.3504464
0
ROW9
-0.334821
0
0.0044643
-0.066964
0
0.3504464
0.3571429
0.3504464
0.6004464
0.3504464
0
ROW10
-0.334821
0
0.0044643
-0.066964
0
0.3504464
0.3571429
0.3504464
0.3504464
0.6004464
0
ROW11
0
0
0
0
0
0
0
0
0
0
0
VAR_LT2
0.3725389
0
0
0
0
0
0
0.5222197
0
0
0
-0.009979
0
0
0.3725389
0
0
0
0
0
0
0.3725389
0
0
0
0
0
0
0.3725389
0
0
-0.009979
0
0
0
0.5222197
EST_LT2
Ĉ  L'β
 
1
var Cˆ  L'  X ' X   2  L


Thursday September 25, 2008
SE_LT2
34.3
0.6103597
33.833036
0.7226477
36.7
0.6103597
36.05
0.6103597
35.1
0.6103597
36.954464
0.7226477
9
COL11
ST 524
Treatment Comparison: Contrasts
NCSU - Fall 2008
VAR_CNTRT
0.7450778
-0.372539
0
0
0
-0.372539
0.8947587
-0.52222
-0.26111
0.0399149
0
-0.52222
0.8947587
0.0748404
-0.039915
0
-0.26111
0.0748404
0.5962286
-0.019957
0
0.0399149
-0.039915
-0.019957
0.6067062
EST_CNTRT
SE_CNTRT
-0.8
0.8631789
-0.466964
0.9459168
2.8669643
0.9459168
0.7834821
0.7721584
-1.757857
0.7789135
VAR_OCNTRT
0.6067062
-0.013305
0.0099787
0.0199574
-0.039915
-0.013305
0.5133498
-0.012473
-0.024947
0.0498936
0.0099787
-0.012473
0.4750287
0.0187101
-0.03742
0.0199574
-0.024947
0.0187101
0.5962286
-0.07484
-0.039915
0.0498936
-0.03742
-0.07484
0.8947587
EST_OCNTRT
SE_OCNTRT
-1.757857
0.7789135
1.1056548
0.7164843
0.1207589
0.6892233
0.9665179
0.7721584
2.8669643
0.9459168
Sum of Squares – Contrast C



  ci ˆ i 

SS  C    i
ci2
i r
i
Thursday September 25, 2008
2
var  C   var( ci ˆi )   ci2 var  ˆi 
10
ST 524
Treatment Comparison: Contrasts
Thursday September 25, 2008
NCSU - Fall 2008
11