The MIXED Procedure

Example 78.4 Known G and R

(View the complete code for this example.)

This animal breeding example from Henderson (1984, p. 48) considers multiple traits. The data are artificial and consist of measurements of two traits on three animals, but the second trait of the third animal is missing. Assuming an additive genetic model, you can use PROC MIXED to predict the breeding value of both traits on all three animals and also to predict the second trait of the third animal. The data are as follows:

data h;
   input Trait Animal Y;
   datalines;
1 1 6
1 2 8
1 3 7
2 1 9
2 2 5
2 3 .
;

Both and are known.

In order to read into PROC MIXED by using the GDATA= option in the RANDOM statement, perform the following DATA step:

data g;
   input Row Col1-Col6;
   datalines;
1  2  1  1  2   1     1
2  1  2 .5  1   2    .5
3  1 .5  2  1    .5  2
4  2  1  1  3   1.5  1.5
5  1  2 .5  1.5 3     .75
6  1 .5  2  1.5  .75 3
;

The preceding data are in the dense representation for a GDATA= data set. You can also construct a data set with the sparse representation by using Row, Col, and Value variables, although this would require 21 observations instead of 6 for this example.

The PROC MIXED statements are as follows:

proc mixed data=h mmeq mmeqsol;
   class Trait Animal;
   model Y = Trait / noint s outp=predicted;
   random Trait*Animal / type=un gdata=g g gi s;
   repeated / type=un sub=Animal r ri;
   parms (4) (1) (5) / noiter;
run;
proc print data=predicted;
run;

The MMEQ and MMEQSOL options request the mixed model equations and their solution. The variables Trait and Animal are classification variables, and Trait defines the entire matrix for the fixed-effects portion of the model, since the intercept is omitted with the NOINT option. The fixed-effects solution vector and predicted values are also requested by using the S and OUTP= options, respectively.

The random effect Trait*Animal leads to a matrix with six columns, the first five corresponding to the identity matrix and the last consisting of 0s. An unstructured matrix is specified by using the TYPE=UN option, and it is read into PROC MIXED from a SAS data set by using the GDATA=G specification. The G and GI options request the display of and , respectively. The S option requests that the random-effects solution vector be displayed.

Note that the preceding matrix is block diagonal if the data are sorted by animals. The REPEATED statement exploits this fact by requesting to have unstructured 22 blocks corresponding to animals, which are the subjects. The R and RI options request that the estimated 22 blocks for the first animal and its inverse be displayed. The PARMS statement lists the parameters of this 22 matrix. Note that the parameters from are not specified in the PARMS statement because they have already been assigned by using the GDATA= option in the RANDOM statement. The NOITER option prevents PROC MIXED from computing residual (restricted) maximum likelihood estimates; instead, the known values are used for inferences.

The results from this analysis are shown in Output 78.4.1–Output 78.4.12.

The "Unstructured" covariance structure (Output 78.4.1) applies to both and here. The levels of Trait and Animal have been specified correctly.

Output 78.4.1: Model and Class Level Information

The Mixed Procedure

Model Information
Data SetWORK.H
Dependent VariableY
Covariance StructureUnstructured
Subject EffectAnimal
Estimation MethodREML
Residual Variance MethodNone
Fixed Effects SE MethodModel-Based
Degrees of Freedom MethodContainment

Class Level Information
ClassLevelsValues
Trait21 2
Animal31 2 3


The three covariance parameters indicated in Output 78.4.2 correspond to those from the matrix. Those from are considered fixed and known because of the GDATA= option.

Output 78.4.2: Model Dimensions and Number of Observations

Dimensions
Covariance Parameters3
Columns in X2
Columns in Z6
Subjects1
Max Obs per Subject5

Number of Observations
Number of Observations Read6
Number of Observations Used5
Number of Observations Not Used1


Because starting values for the covariance parameters are specified in the PARMS statement, the MIXED procedure prints the residual (restricted) log likelihood at the starting values. Because of the NOITER option in the PARMS statement, this is also the final log likelihood in this analysis (Output 78.4.3).

Output 78.4.3: REML Log Likelihood

Parameter Search
CovP1CovP2CovP3Res Log Like-2 Res Log Like
4.00001.00005.0000-7.373114.7463


The block of corresponding to the first animal and the inverse of this block are shown in Output 78.4.4.

Output 78.4.4: Inverse R Matrix

Estimated R Matrix for Animal 1
RowCol1Col2
14.00001.0000
21.00005.0000

Estimated Inv(R) Matrix for
Animal 1
RowCol1Col2
10.2632-0.05263
2-0.052630.2105


The matrix as specified in the GDATA= data set and its inverse are shown in Output 78.4.5 and Output 78.4.6.

Output 78.4.5: G Matrix

Estimated G Matrix
RowEffectTraitAnimalCol1Col2Col3Col4Col5Col6
1Trait*Animal112.00001.00001.00002.00001.00001.0000
2Trait*Animal121.00002.00000.50001.00002.00000.5000
3Trait*Animal131.00000.50002.00001.00000.50002.0000
4Trait*Animal212.00001.00001.00003.00001.50001.5000
5Trait*Animal221.00002.00000.50001.50003.00000.7500
6Trait*Animal231.00000.50002.00001.50000.75003.0000


Output 78.4.6: Inverse G Matrix

Estimated Inv(G) Matrix
RowEffectTraitAnimalCol1Col2Col3Col4Col5Col6
1Trait*Animal112.5000-1.0000-1.0000-1.66670.66670.6667
2Trait*Animal12-1.00002.0000 0.6667-1.3333 
3Trait*Animal13-1.0000 2.00000.6667 -1.3333
4Trait*Animal21-1.66670.66670.66671.6667-0.6667-0.6667
5Trait*Animal220.6667-1.3333 -0.66671.3333 
6Trait*Animal230.6667 -1.3333-0.6667 1.3333


The table of covariance parameter estimates in Output 78.4.7 displays only the parameters in . Because of the GDATA= option in the RANDOM statement, the G-side parameters do not participate in the parameter estimation process. Because of the NOITER option in the PARMS statement, however, the R-side parameters in this output are identical to their starting values.

Output 78.4.7: R-Side Covariance Parameters

Covariance Parameter Estimates
Cov ParmSubjectEstimate
UN(1,1)Animal4.0000
UN(2,1)Animal1.0000
UN(2,2)Animal5.0000


The coefficients of the mixed model equations in Output 78.4.8 agree with Henderson (1984, p. 55). Recall from Output 78.4.1 that there are 2 columns in and 6 columns in . The first 8 columns of the mixed model equations correspond to the and components. Column 9 represents the Y border.

Output 78.4.8: Mixed Model Equations with Y Border

Mixed Model Equations
RowEffectTraitAnimalCol1Col2Col3Col4Col5Col6Col7Col8Col9
1Trait1 0.7763-0.10530.26320.26320.2500-0.05263-0.05263 4.6974
2Trait2 -0.10530.4211-0.05263-0.05263 0.21050.2105 2.2105
3Trait*Animal110.2632-0.052632.7632-1.0000-1.0000-1.71930.66670.66671.1053
4Trait*Animal120.2632-0.05263-1.00002.2632 0.6667-1.3860 1.8421
5Trait*Animal130.2500 -1.0000 2.25000.6667 -1.33331.7500
6Trait*Animal21-0.052630.2105-1.71930.66670.66671.8772-0.6667-0.66671.5789
7Trait*Animal22-0.052630.21050.6667-1.3860 -0.66671.5439 0.6316
8Trait*Animal23  0.6667 -1.3333-0.6667 1.3333 


The solution to the mixed model equations also matches that given by Henderson (1984, p. 55). After solving the augmented mixed model equations, you can find the solutions for fixed and random effects in the last column (Output 78.4.9).

Output 78.4.9: Solutions of the Mixed Model Equations with Y Border

Mixed Model Equations Solution
RowEffectTraitAnimalCol1Col2Col3Col4Col5Col6Col7Col8Col9
1Trait1 2.55081.5685-1.3047-1.1775-1.1701-1.3002-1.1821-1.16786.9909
2Trait2 1.56854.5539-1.4112-1.3534-0.9410-2.1592-2.1055-1.31496.9959
3Trait*Animal11-1.3047-1.41121.82821.06521.02061.80101.09251.00700.05450
4Trait*Animal12-1.1775-1.35341.06521.75890.70851.09001.73410.7209-0.04955
5Trait*Animal13-1.1701-0.94101.02060.70851.78121.00950.71971.77560.02230
6Trait*Animal21-1.3002-2.15921.80101.09001.00952.75181.63921.48490.2651
7Trait*Animal22-1.1821-2.10551.09251.73410.71971.63922.68740.9930-0.2601
8Trait*Animal23-1.1678-1.31491.00700.72091.77561.48490.99302.76450.1276


The solutions for the fixed and random effects in Output 78.4.10 correspond to the last column in Output 78.4.9. Note that the standard errors for the fixed effects and the prediction standard errors for the random effects are the square root values of the diagonal entries in the solution of the mixed model equations (Output 78.4.9).

Output 78.4.10: Solutions for Fixed and Random Effects

Solution for Fixed Effects
EffectTraitEstimateStandard
Error
DFt ValuePr > |t|
Trait16.99091.597134.380.0221
Trait26.99592.134033.280.0465

Solution for Random Effects
EffectTraitAnimalEstimateStd Err PredDFt ValuePr > |t|
Trait*Animal110.054501.352100.04.
Trait*Animal12-0.049551.32620-0.04.
Trait*Animal130.022301.334600.02.
Trait*Animal210.26511.658900.16.
Trait*Animal22-0.26011.63930-0.16.
Trait*Animal230.12761.662700.08.


The estimates for the two traits are nearly identical, but the standard error of the second trait is larger because of the missing observation.

The Estimate column in the "Solution for Random Effects" table lists the best linear unbiased predictions (BLUPs) of the breeding values of both traits for all three animals. The p-values are missing because the default containment method for computing degrees of freedom results in zero degrees of freedom for the random effects parameter tests.

Output 78.4.11: Significance Test Comparing Traits

Type 3 Tests of Fixed Effects
EffectNum DFDen DFF ValuePr > F
Trait2310.590.0437


The two estimated traits are significantly different from zero at the 5% level (Output 78.4.11).

Output 78.4.12 displays the predicted values of the observations based on the trait and breeding value estimates—that is, the fixed and random effects.

Output 78.4.12: Predicted Observations

ObsTraitAnimalYPredStdErrPredDFAlphaLowerUpperResid
11167.045421.3302700.05..-1.04542
21286.941371.3980600.05..1.05863
31377.013211.4112900.05..-0.01321
42197.260941.7283900.05..1.73906
52256.735761.7407700.05..-1.73576
623.7.120152.9908800.05...


The predicted values are not the predictions of future records in the sense that they do not contain a component corresponding to a new observational error. See Henderson (1984) for information about predicting future records. The Lower and Upper columns usually contain confidence limits for the predicted values; they are missing here because the random-effects parameter degrees of freedom equals 0.