Chapter Contents 
Previous 
Next 
The MIXED Procedure 
PROC MIXED can fit a variety of mixed models. One of the most common mixed models is the splitplot design. The splitplot design involves two experimental factors, A and B. Levels of A are randomly assigned to whole plots (main plots), and levels of B are randomly assigned to split plots (subplots) within each whole plot. The design provides more precise information about B than about A, and it often arises when A can be applied only to large experimental units. An example is where A represents irrigation levels for large plots of land and B represents different crop varieties planted in each large plot.
Consider the following data from Stroup (1989a), which arise from a balanced splitplot design with the whole plots arranged in a randomized completeblock design. The variable A is the wholeplot factor, and the variable B is the subplot factor. A traditional analysis of these data involves the construction of the wholeplot error (A*Block) to test A and the pooled residual error (B*Block and A*B*Block) to test B and A*B. To carry out this analysis with PROC GLM, you must use a TEST statement to obtain the correct Ftest for A.
Performing a mixed model analysis with PROC MIXED eliminates the need for the error term construction. PROC MIXED estimates variance components for Block, A*Block, and the residual, and it automatically incorporates the correct error terms into test statistics.
data sp; input Block A B Y @@; datalines; 1 1 1 56 1 1 2 41 1 2 1 50 1 2 2 36 1 3 1 39 1 3 2 35 2 1 1 30 2 1 2 25 2 2 1 36 2 2 2 28 2 3 1 33 2 3 2 30 3 1 1 32 3 1 2 24 3 2 1 31 3 2 2 27 3 3 1 15 3 3 2 19 4 1 1 30 4 1 2 25 4 2 1 35 4 2 2 30 4 3 1 17 4 3 2 18 ; proc mixed; class A B Block; model Y = A B A*B; random Block A*Block; run;
The variables A, B, and Block are listed as classification variables in the CLASS statement. The columns of model matrix X consist of indicator variables corresponding to the levels of the fixed effects A, B, and A*B listed on the righthand side in the MODEL statement. The dependent variable Y is listed on the lefthand side in the MODEL statement.
The columns of the model matrix Z consist of indicator variables corresponding to the levels of the random effects Block and A*Block. The G matrix is diagonal and contains the variance components of Block and A* Block. The R matrix is also diagonal and contains the residual variance.
The SAS code produces Output 41.1.1.
Output 41.1.1: SplitPlot Example

The "Class Level Information" table lists the levels of all variables specified in the CLASS statement. You can check this table to make sure that the data are correct.


The minimization method is the NewtonRaphson algorithm, which uses the first and second derivatives of the objective function to iteratively find its minimum. The "Iteration History" table records the steps of that optimization process. For this example, only one iteration is required to obtain the estimates. The Evaluations column reveals that the restricted likelihood is evaluated once for each of the iterations. A criterion of 0 indicates that the NewtonRaphson algorithm has converged.



proc glm data=sp; class A B Block; model Y = A B A*B Block A*Block; test h=A e=A*Block; run;
You can continue this analysis by producing solutions for the fixed and random effects and then testing various linear combinations of them by using the CONTRAST and ESTIMATE statements. If you use the same CONTRAST and ESTIMATE statements with PROC GLM, the test statistics correspond to the fixedeffectsonly model. The test statistics from PROC MIXED incorporate the random effects.
The various "inference space" contrasts given by Stroup (1989a) can be implemented via the ESTIMATE statement. Consider the following examples:
estimate 'a1 mean narrow' intercept 1 A 1 B .5 .5 A*B .5 .5  Block .25 .25 .25 .25 A*Block .25 .25 .25 .25 0 0 0 0 0 0 0 0; estimate 'a1 mean intermed' intercept 1 A 1 B .5 .5 A*B .5 .5  Block .25 .25 .25 .25; estimate 'a1 mean broad' intercept 1 a 1 b .5 .5 A*B .5 .5;
These statements result in Output 41.1.2.
Output 41.1.2: Inference Space Results

The following statements illustrate another feature of the RANDOM statement. Recall that the basic code for a splitplot design with whole plots arranged in randomized blocks is as follows.
proc mixed; class A B Block; model Y = A B A*B; random Block A*Block; run;
An equivalent way of specifying this model is
proc mixed data=sp; class A B Block; model Y = A B A*B; random intercept A / subject=Block; run;
In general, if all of the effects in the RANDOM statement can be nested within one effect, you can specify that one effect using the SUBJECT= option. The subject effect is, in a sense, "factored out" of the random effects. The specification using the SUBJECT= effect can result in quicker execution times for large problems because PROC MIXED is able to perform the likelihood calculations separately for each subject.
Chapter Contents 
Previous 
Next 
Top 
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.