Chapter Contents Previous Next
 The GLM Procedure

## Example 30.1: Balanced Data from Randomized Complete Block with Means Comparisons and Contrasts

The following example* 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 only produced by default 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 30.1.1 through Output 30.1.5:

```   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 30.1.1: Standard Analysis for Randomized Complete Block

 Balanced Data from Randomized Complete Block

 The GLM Procedure

 Class Level Information Class Levels Values Block 3 1 2 3 Type 7 Clarion Clinton Compost Knox O'Neill Wabash Webster

 Number of observations 21

 Balanced Data from Randomized Complete Block

 The GLM Procedure Dependent Variable: StemLength

 Source DF Sum of Squares Mean Square F Value Pr > F Model 8 142.1885714 17.7735714 10.80 0.0002 Error 12 19.7428571 1.6452381 Corrected Total 20 161.9314286

 R-Square Coeff Var Root MSE StemLength Mean 0.878079 3.939745 1.282668 32.55714

 Source DF Type I SS Mean Square F Value Pr > F Block 2 39.0371429 19.5185714 11.86 0.0014 Type 6 103.1514286 17.1919048 10.45 0.0004

 Source DF Type III SS Mean Square F Value Pr > F Block 2 39.0371429 19.5185714 11.86 0.0014 Type 6 103.1514286 17.1919048 10.45 0.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 between the three blocks in the experiment.

Output 30.1.2: Standard Analysis Again

 Balanced Data from Randomized Complete Block

 The GLM Procedure

 Class Level Information Class Levels Values Block 3 1 2 3 Type 7 Clarion Clinton Compost Knox O'Neill Wabash Webster

 Number of observations 21

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.

Output 30.1.3: Contrasts and Solutions

 Balanced Data from Randomized Complete Block

 The GLM Procedure Dependent Variable: StemLength

 Contrast DF Contrast SS Mean Square F Value Pr > F Compost vs. others 1 29.24198413 29.24198413 17.77 0.0012 River soils vs. non 2 48.24694444 24.12347222 14.66 0.0006 Glacial vs. drift 1 22.14083333 22.14083333 13.46 0.0032 Clarion vs. Webster 1 1.70666667 1.70666667 1.04 0.3285 Knox vs. O'Neill 1 1.81500000 1.81500000 1.10 0.3143

 Parameter Estimate Standard Error t Value Pr > |t| Intercept 29.35714286 B 0.83970354 34.96 <.0001 Block 1 3.32857143 B 0.68561507 4.85 0.0004 Block 2 1.90000000 B 0.68561507 2.77 0.0169 Block 3 0.00000000 B . . . Type Clarion 1.06666667 B 1.04729432 1.02 0.3285 Type Clinton -0.80000000 B 1.04729432 -0.76 0.4597 Type Knox 3.80000000 B 1.04729432 3.63 0.0035 Type O'Neill 2.70000000 B 1.04729432 2.58 0.0242 Type Compost -1.43333333 B 1.04729432 -1.37 0.1962 Type Wabash 4.86666667 B 1.04729432 4.65 0.0006 Type Webster 0.00000000 B . . .

 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.

Output 30.1.3 shows the tests for contrasts that you specified as well as the estimated parameters. 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 show that 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) is significantly different from the average stem length of those grown in drift soils (Knox and O'Neill)
• stem lengths for Clarion and Webster are not significantly different
• stem lengths for Knox and O'Neill 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 30.1.4: 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.

 Kratio 100 Error Degrees of Freedom 12 Error Mean Square 1.64524 F Value 10.45 Critical Value of t 2.12034 Minimum Significant Difference 2.2206

 Means with the same letter arenot significantly different. Waller Grouping Mean N Type A 35.967 3 Wabash A A 34.900 3 Knox A B A 33.800 3 O'Neill B B C 32.167 3 Clarion C D C 31.100 3 Webster D C D C 30.300 3 Clinton D D 29.667 3 Compost

Output 30.1.5: 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.

 Alpha 0.05 Error Degrees of Freedom 12 Error Mean Square 1.64524

 Number of Means 2 3 4 5 6 7 Critical Range 2.98766 3.28383 3.43963 3.54022 3.54022 3.66342

 Means with the same letter arenot significantly different. REGWQ Grouping Mean N Type A 35.967 3 Wabash A B A 34.900 3 Knox B A B A C 33.800 3 O'Neill B C B D C 32.167 3 Clarion D C D C 31.100 3 Webster D D 30.300 3 Clinton D D 29.667 3 Compost

The final two pages of output (Output 30.1.4 and Output 30.1.5) present results of the Waller-Duncan and REGWQ multiple comparison procedures. For each test, notes and information pertinent to the test are given on 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.

 Chapter Contents Previous Next Top