The GLM Procedure

Example 47.1 Randomized Complete Blocks with Means Comparisons and Contrasts

(View the complete code for this example.)

This example, reported by Stenstrom (1940), analyzes an experiment to investigate how snapdragons grow in various soils. To eliminate the effect of local fertility variations, the experiment is run in blocks, with each soil type sampled in each block. Since these data are balanced, the Type I and Type III SS are the same and are equal to the traditional ANOVA SS.

First, the standard analysis is shown, followed by an analysis that uses the SOLUTION option and includes MEANS and CONTRAST statements. The ORDER=DATA option in the second PROC GLM statement is used so that the ordering of coefficients in the CONTRAST statement can correspond to the ordering in the input data. The SOLUTION option requests a display of the parameter estimates, which are produced by default only if there are no CLASS variables. A MEANS statement is used to request a table of the means with two multiple-comparison procedures requested. In experiments with focused treatment questions, CONTRAST statements are preferable to general means comparison methods. The following statements produce Output 47.1.1 through Output 47.1.4.

title 'Balanced Data from Randomized Complete Block';
data plants;
   input Type $ @;
   do Block = 1 to 3;
      input StemLength @;
      output;
   end;
   datalines;
Clarion  32.7 32.3 31.5
Clinton  32.1 29.7 29.1
Knox     35.7 35.9 33.1
O'Neill  36.0 34.2 31.2
Compost  31.8 28.0 29.2
Wabash   38.2 37.8 31.9
Webster  32.5 31.1 29.7
;
proc glm;
   class Block Type;
   model StemLength = Block Type;
run;
proc glm order=data;
   class Block Type;
   model StemLength = Block Type / solution;

   /*----------------------------------clrn-cltn-knox-onel-cpst-wbsh-wstr */
   contrast 'Compost vs. others'  Type   -1   -1   -1   -1    6   -1   -1;
   contrast 'River soils vs. non' Type   -1   -1   -1   -1    0    5   -1,
                                  Type   -1    4   -1   -1    0    0   -1;
   contrast 'Glacial vs. drift'   Type   -1    0    1    1    0    0   -1;
   contrast 'Clarion vs. Webster' Type   -1    0    0    0    0    0    1;
   contrast "Knox vs. O'Neill"    Type    0    0    1   -1    0    0    0;
run;

   means Type / waller regwq;
run;

Output 47.1.1: Analysis of Variance for Randomized Complete Blocks

Balanced Data from Randomized Complete Block

The GLM Procedure

Class Level Information
ClassLevelsValues
Block31 2 3
Type7Clarion Clinton Compost Knox O'Neill Wabash Webster

Number of Observations Read21
Number of Observations Used21

Balanced Data from Randomized Complete Block

The GLM Procedure
 
Dependent Variable: StemLength

SourceDFSum of SquaresMean SquareF ValuePr > F
Model8142.188571417.773571410.800.0002
Error1219.74285711.6452381  
Corrected Total20161.9314286   

R-SquareCoeff VarRoot MSEStemLength Mean
0.8780793.9397451.28266832.55714

SourceDFType I SSMean SquareF ValuePr > F
Block239.037142919.518571411.860.0014
Type6103.151428617.191904810.450.0004

SourceDFType III SSMean SquareF ValuePr > F
Block239.037142919.518571411.860.0014
Type6103.151428617.191904810.450.0004


This analysis shows that the stem length is significantly different for the different soil types. In addition, there are significant differences in stem length among the three blocks in the experiment.

The GLM procedure is invoked again, this time with the ORDER=DATA option. This enables you to write accurate contrast statements more easily because you know the order SAS is using for the levels of the variable Type. The standard analysis is displayed again, this time including the tests for contrasts that you specified as well as the estimated parameters. These additional results are shown in Output 47.1.2.

Output 47.1.2: Contrasts and Solutions

Balanced Data from Randomized Complete Block

The GLM Procedure
 
Dependent Variable: StemLength

ContrastDFContrast SSMean SquareF ValuePr > F
Compost vs. others129.2419841329.2419841317.770.0012
River soils vs. non248.2469444424.1234722214.660.0006
Glacial vs. drift122.1408333322.1408333313.460.0032
Clarion vs. Webster11.706666671.706666671.040.3285
Knox vs. O'Neill11.815000001.815000001.100.3143

ParameterEstimate Standard
Error
t ValuePr > |t|
Intercept29.35714286B0.8397035434.96<.0001
Block 13.32857143B0.685615074.850.0004
Block 21.90000000B0.685615072.770.0169
Block 30.00000000B...
Type Clarion1.06666667B1.047294321.020.3285
Type Clinton-0.80000000B1.04729432-0.760.4597
Type Knox3.80000000B1.047294323.630.0035
Type O'Neill2.70000000B1.047294322.580.0242
Type Compost-1.43333333B1.04729432-1.370.1962
Type Wabash4.86666667B1.047294324.650.0006
Type Webster0.00000000B...


Note:The X'X matrix has been found to be singular, and a generalized inverse was used to solve the normal equations. Terms whose estimates are followed by the letter 'B' are not uniquely estimable.


The contrast label, degrees of freedom, sum of squares, Mean Square, F Value, and Pr > F are shown for each contrast requested. In this example, the contrast results indicate the following inferences, at the 5% significance level:

  • The stem length of plants grown in compost soil is significantly different from the average stem length of plants grown in other soils.

  • The stem length of plants grown in river soils is significantly different from the average stem length of those grown in nonriver soils.

  • The average stem length of plants grown in glacial soils (Clarion and Webster types) is significantly different from the average stem length of those grown in drift soils (Knox and O’Neill types).

  • Stem lengths for Clarion and Webster types are not significantly different.

  • Stem lengths for Knox and O’Neill types are not significantly different.

In addition to the estimates for the parameters of the model, the results of t tests about the parameters are also displayed. The ‘B’ following the parameter estimates indicates that the estimates are biased and do not represent a unique solution to the normal equations.

Output 47.1.3: Waller-Duncan tests

Balanced Data from Randomized Complete Block

The GLM Procedure
 
Waller-Duncan K-ratio t Test for StemLength


Note:This test minimizes the Bayes risk under additive loss and certain other assumptions.

Kratio100
Error Degrees of Freedom12
Error Mean Square1.645238
F Value10.45
Critical Value of t2.12034
Minimum Significant Difference2.2206

Means with the same letter are
not significantly different.
Waller GroupingMeanNType
 A35.9673Wabash
 A   
 A34.9003Knox
 A   
BA33.8003O'Neill
B    
BC32.1673Clarion
 C   
DC31.1003Webster
DC   
DC30.3003Clinton
D    
D 29.6673Compost


Output 47.1.4: Ryan-Einot-Gabriel-Welsch Multiple Range Test

Balanced Data from Randomized Complete Block

The GLM Procedure
 
Ryan-Einot-Gabriel-Welsch Multiple Range Test for StemLength


Note:This test controls the Type I experimentwise error rate.

Alpha0.05
Error Degrees of Freedom12
Error Mean Square1.645238

Number of Means234567
Critical Range2.98755283.28373223.43956253.54023833.54023833.6653133

Means with the same letter are
not significantly different.
REGWQ GroupingMeanNType
 A 35.9673Wabash
 A    
BA 34.9003Knox
BA    
BAC33.8003O'Neill
B C   
BDC32.1673Clarion
 DC   
 DC31.1003Webster
 D    
 D 30.3003Clinton
 D    
 D 29.6673Compost


The final two pages of output (Output 47.1.3 and Output 47.1.4) present results of the Waller-Duncan and REGWQ multiple-comparison procedures. For each test, notes and information pertinent to the test are given in the output. The Type means are arranged from highest to lowest. Means with the same letter are not significantly different. For this example, while some pairs of means are significantly different, there are no clear equivalence classes among the different soils.

For an alternative method of analyzing and displaying mean differences, including high-resolution graphics, see Example 47.3.