LSMEANCALCULATION_sep1608.doc

ST 524
RCBD and Missing observations
NCSU - Fall 2008
Oil Content of Redwing Flaxseed inoculated at different stages of growth
with S. linicola, Winnipeg, 1947 (in percentage)
treat
block_1
block_2
block_3
block_4
Mean
Early_Bloom
33.3
31.9
34.9
37.1
34.300
Full_Bloom
34.4
34.0
34.5
33.1
34.000
Full_Bloom_P
36.8
36.6
37.0
36.4
36.700
Ripening
36.3
34.9
35.9
37.1
36.050
Seedling
34.4
35.9
36.0
34.1
35.100
Uninoculated
36.4
37.3
37.7
36.7
37.025
Mean
35.2667
35.1000
36.0000
35.7500
35.52917
Linear Model
Y  Xβ  e
F

, eij ~ iidN 0,  e2

Yij     i   j  eij ,
Treatment effect and Block effect
 i  i.  ..
 j  . j  ..
ˆi  y i.  y..
ˆ j  y. j  y..
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
SS  Block |  
Source
SS Treat | Block ,  
SS  Block | Treat 
SS Treat | Block 
block
treat
Source
block
treat
Tuesday September 16, 2008
R-Square
Coeff Var
Root MSE
y Mean
0.638298
3.226870
1.146480
35.52917
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
1
ST 524
RCBD and Missing observations
NCSU - Fall 2008
Balanced Design:
Type I and Type III SS are the same: Block and Treatments are uncorrelated.
Solution to linear model
Parameter
Intercept
block
block
block
block
treat
treat
treat
treat
treat
treat
Predicted value for observations
Standard
Error
t Value
Pr > |t|
0.70207282
0.66192061
0.66192061
0.66192061
.
0.81068387
0.81068387
0.81068387
0.81068387
0.81068387
.
53.05
-0.73
-0.98
0.38
.
-3.36
-3.73
-0.40
-1.20
-2.37
.
<.0001
0.4765
0.3417
0.7110
.
0.0043
0.0020
0.6941
0.2477
0.0313
.
Estimate
1
2
3
4
Early_Bloom
Full_Bloom
Full_Bloom_P
Ripening
Seedling
uninoculated
37.24583333
-0.48333333
-0.65000000
0.25000000
0.00000000
-2.72500000
-3.02500000
-0.32500000
-0.97500000
-1.92500000
0.00000000
B
B
B
B
B
B
B
B
B
B
B
y11 , y23 , y64
 37.2458 
 2.725 


 3.025 


 0.3250 
 yˆ11  1 1 0 0 0 0 0 1 0 0 0   0.9750  37.2458  2.725  0.4833 34.0375
 yˆ   1 0 1 0 0 0 0 0 0 1 0   1.9250    37.2458  3.025  0.25   34.4708
 
 23  

 

 yˆ 64  1 0 0 0 0 0 1 0 0 0 1   0  
 37.2458
37.2458


 0.4833
 0.6500 


 0.2500 


 0 
Note that, predicted value is a function of the effects
ˆi and ˆ j
34.0375 = 35.52917 + (34.3000 - 35.52917) + (35.2667 - 35.52917)
34.4708 = 35.52917 + (34.0000 - 35.52917) + (36.0000 - 35.52917)
37.2458 = 35.52917 + (
- 35.52917) + (
- 35.52917)
Least Squares Mean for Treatment - Treatment LSMEAN
Average for each treatment level over the block effects
 37.2458 
 2.725 


 3.025 


 0.3250 

 37.2458   2.725   1 4   0.4833  0.6500  0.2500  0    34.3 
ˆ

1
1
0
0
0
0
0
1
4
1
4
1
4
1
4

0.9750
 1.  

 ˆ   1 0 1 0 0 0 0 1 4 1 4 1 4 1 4   1.9250   37.2458  3.025  1 4 0.4833  0.6500  0.2500  0    34.0 

  
 
2.

 
  


 37.025 
 ˆ 6.  1 0 0 0 0 0 1 1 4 1 4 1 4 1 4   0  
37.2458  0  1 4  0.4833  0.6500  0.2500  0 


 0.4833
 0.6500 


 0.2500 


 0 
Balanced Design with no missing observations:
Simple Arithmetic Mean = Least Squares Mean
ErrorMS
1.3144
LSMEAN Standard Error =

 0.5732401
r
4
treat
Standard
Early_Bloom
Full_Bloom
Full_Bloom_P
Ripening
Seedling
uninoculated
Tuesday September 16, 2008
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
2
ST 524
RCBD and Missing observations
NCSU - Fall 2008
Missing observations
treat
block_1
block_2
block_3
block_4
Mean
Early_Bloom
33.3
31.9
34.9
37.1
34.300
Full_Bloom
34.4
.
34.5
33.1
34.000
Full_Bloom_P
36.8
36.6
37.0
36.4
36.700
Ripening
36.3
34.9
35.9
37.1
36.050
Seedling
34.4
35.9
36.0
34.1
35.100
Uninoculated
36.4
37.3
.
36.7
36.80
Mean
35.2667
35.3200
35.6600
35.7500
35.5000
The GLM Procedure
Level of
treat
N
Early_Bloom
Full_Bloom
Full_Bloom_P
Ripening
Seedling
uninoculated
4
3
4
4
4
3
Level of
block
N
1
2
3
4
6
5
5
6
--------------y-------------Mean
Std Dev
34.3000000
34.0000000
36.7000000
36.0500000
35.1000000
36.8000000
2.23308456
0.78102497
0.25819889
0.91469485
0.98994949
0.45825757
--------------y-------------Mean
Std Dev
35.2666667
35.3200000
35.6600000
35.7500000
1.41938954
2.10760528
0.98640762
1.71551741
Analysis of Variance Table
The GLM Procedure
Dependent Variable: y
Sum of
DF
Source
SS Treat | Block ,  
SS  Block | Treat 
SS Treat | Block 
Mean Square
F Value
Pr > F
2.35
0.0820
Model
8
28.06797619
3.50849702
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
SS  Block |  
Squares
block
treat
Source
block
treat
Missing observations:
Tuesday September 16, 2008
Type I SS
DF
Type I SS
Mean Square
F Value
Pr > F
3
5
0.99166667
27.07630952
0.33055556
5.41526190
0.22
3.63
0.8795
0.0282
DF
Type III SS
Mean Square
F Value
Pr > F
3
5
2.87797619
27.07630952
0.95932540
5.41526190
0.64
3.63
0.6005
0.0282
 Type III SS
3
ST 524
RCBD and Missing observations
NCSU - Fall 2008
Solution
Parameter
Intercept
block
block
block
block
treat
treat
treat
treat
treat
treat
Estimate
37.21488095
-0.48333333
-0.76130952
0.20297619
0.00000000
-2.65446429
-3.12142857
-0.25446429
-0.90446429
-1.85446429
0.00000000
1
2
3
4
Early_Bloom
Full_Bloom
Full_Bloom_P
Ripening
Seedling
uninoculated
B
B
B
B
B
B
B
B
B
B
B
Standard
Error
t Value
Pr > |t|
0.81834165
0.70478263
0.75049541
0.75049541
.
0.94591683
1.03169613
0.94591683
0.94591683
0.94591683
.
45.48
-0.69
-1.01
0.27
.
-2.81
-3.03
-0.27
-0.96
-1.96
.
<.0001
0.5049
0.3289
0.7911
.
0.0149
0.0097
0.7921
0.3564
0.0717
.
Least Squares Mean for Treatment - Treatment LSMEAN
Average for each treatment level over the block effects
 37.2149 
 2.6545


 3.1214 


 0.2545

 37.2149   2.6545   1 4   0.4833  0.7613  0.2030  0    34.3 
ˆ

1
1
0
0
0
0
0
1
4
1
4
1
4
1
4

0.9045
 1.  

 ˆ   1 0 1 0 0 0 0 1 4 1 4 1 4 1 4   1.8545  37.2149  3.1214  1 4 0.4833  0.7613  0.2030  0   33.8331

  
 
2.

 
  




 36.9545 
37.2149  0  1 4  0.4833  0.7613  0.2030  0 
 ˆ 6.  1 0 0 0 0 0 1 1 4 1 4 1 4 1 4   0  
 0.4833
 0.7613


 0.2030 


 0 
Standard
treat
y LSMEAN
Error
Pr > |t|
Early_Bloom
Full_Bloom
Full_Bloom_P
Ripening
Seedling
uninoculated
Balanced Design with missing observations:
Least squares means are estimates of
34.3000000
33.8330357
36.7000000
36.0500000
35.1000000
36.9544643
Simple Arithmetic Mean
 i  
0.6103597
0.7226477
0.6103597
0.6103597
0.6103597
0.7226477

<.0001
<.0001
<.0001
<.0001
<.0001
<.0001
Least Squares Mean
Pairwise differences of LSMEANS are free of block effects.
ErrorMS
1.49016

 0.6104, for r  4,
ri
ri
But se(Full Bloom LSMEAN) = 0.7226  0.7048
LSMEAN Standard Error =
0.7048, for r  3
To calculate LSMEANS we can use the ESTIMATE statement in PROC GLM or proc MIXED
Estimates
Label
LSMEAN
LSMEAN
LSMEAN
LSMEAN
LSMEAN
LSMEAN
T1
T2
T3
T4
T5
T6
Estimate
Standard
Error
DF
t Value
Pr > |t|
34.3000
33.8330
36.7000
36.0500
35.1000
36.9545
0.6104
0.7226
0.6104
0.6104
0.6104
0.7226
13
13
13
13
13
13
56.20
46.82
60.13
59.06
57.51
51.14
<.0001
<.0001
<.0001
<.0001
<.0001
<.0001
For LSMEAN (Full BLOOM)
estimate "LSMEAN T2" intercept 4
treat 0 4
block 1 1 1 1/divisor=4;
Tuesday September 16, 2008
4