The MIXED Procedure

Example 78.5 Random Coefficients

(View the complete code for this example.)

This example comes from a pharmaceutical stability data simulation performed by Obenchain (1990). The observed responses are replicate assay results, expressed in percent of label claim, at various shelf ages, expressed in months. The desired mixed model involves three batches of product that differ randomly in intercept (initial potency) and slope (degradation rate). This type of model is also known as a hierarchical or multilevel model (Singer 1998; Sullivan, Dukes, and Losina 1999).

The SAS statements are as follows:

data rc;
   input Batch Month @@;
   Monthc = Month;
   do i = 1 to 6;
      input Y @@;
      output;
   end;
   datalines;
 1   0  101.2 103.3 103.3 102.1 104.4 102.4
 1   1   98.8  99.4  99.7  99.5    .     .
 1   3   98.4  99.0  97.3  99.8    .     .
 1   6  101.5 100.2 101.7 102.7    .     .
 1   9   96.3  97.2  97.2  96.3    .     .
 1  12   97.3  97.9  96.8  97.7  97.7  96.7
 2   0  102.6 102.7 102.4 102.1 102.9 102.6
 2   1   99.1  99.0  99.9 100.6    .     .
 2   3  105.7 103.3 103.4 104.0    .     .
 2   6  101.3 101.5 100.9 101.4    .     .
 2   9   94.1  96.5  97.2 95.6     .     .
 2  12   93.1  92.8  95.4 92.2   92.2  93.0
 3   0  105.1 103.9 106.1 104.1 103.7 104.6
 3   1  102.2 102.0 100.8  99.8    .     .
 3   3  101.2 101.8 100.8 102.6    .     .
 3   6  101.1 102.0 100.1 100.2    .     .
 3   9  100.9  99.5 102.2 100.8    .     .
 3  12   97.8  98.3  96.9  98.4  96.9  96.5
;

proc mixed data=rc;
   class Batch;
   model Y = Month / s;
   random Int Month / type=un sub=Batch s;
run;

In the DATA step, Monthc is created as a duplicate of Month in order to enable both a continuous and a classification version of the same variable. The variable Monthc is used in a subsequent analysis .

In the PROC MIXED statements, Batch is listed as the only classification variable. The fixed effect Month in the MODEL statement is not declared as a classification variable; thus it models a linear trend in time. An intercept is included as a fixed effect by default, and the S option requests that the fixed-effects parameter estimates be produced.

The two random effects are Int and Month, modeling random intercepts and slopes, respectively. Note that Intercept and Month are used as both fixed and random effects. The TYPE=UN option in the RANDOM statement specifies an unstructured covariance matrix for the random intercept and slope effects. In mixed model notation, is block diagonal with unstructured 22 blocks. Each block corresponds to a different level of Batch, which is the SUBJECT= effect. The unstructured type provides a mechanism for estimating the correlation between the random coefficients. The S option requests the production of the random-effects parameter estimates.

The results from this analysis are shown in Output 78.5.1–Output 78.5.9. The "Unstructured" covariance structure in Output 78.5.1 applies to here.

Output 78.5.1: Model Information in Random Coefficients Analysis

The Mixed Procedure

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


Batch is the only classification variable in this analysis, and it has three levels (Output 78.5.2).

Output 78.5.2: Random Coefficients Analysis (continued)

Class Level Information
ClassLevelsValues
Batch31 2 3


The "Dimensions" table in Output 78.5.3 indicates that there are three subjects (corresponding to batches). The 24 observations not used correspond to the missing values of Y in the input data set.

Output 78.5.3: Random Coefficients Analysis (continued)

Dimensions
Covariance Parameters4
Columns in X2
Columns in Z per Subject2
Subjects3
Max Obs per Subject28

Number of Observations
Number of Observations Read108
Number of Observations Used84
Number of Observations Not Used24


As Output 78.5.4 shows, only one iteration is required for convergence.

Output 78.5.4: Random Coefficients Analysis (continued)

Iteration History
IterationEvaluations-2 Res Log LikeCriterion
01367.02768461 
11350.328135770.00000000

Convergence criteria met.


The Estimate column in Output 78.5.5 lists the estimated elements of the unstructured 22 matrix comprising the blocks of . Note that the random coefficients are negatively correlated.

Output 78.5.5: Random Coefficients Analysis (continued)

Covariance Parameter Estimates
Cov ParmSubjectEstimate
UN(1,1)Batch0.9768
UN(2,1)Batch-0.1045
UN(2,2)Batch0.03717
Residual 3.2932


The null model likelihood ratio test indicates a significant improvement over the null model consisting of no random effects and a homogeneous residual error (Output 78.5.6).

Output 78.5.6: Random Coefficients Analysis (continued)

Fit Statistics
-2 Res Log Likelihood350.3
AIC (Smaller is Better)358.3
AICC (Smaller is Better)358.8
BIC (Smaller is Better)354.7

Null Model Likelihood Ratio Test
DFChi-SquarePr > ChiSq
316.700.0008


The fixed-effects estimates represent the estimated means for the random intercept and slope, respectively (Output 78.5.7).

Output 78.5.7: Random Coefficients Analysis (continued)

Solution for Fixed Effects
EffectEstimateStandard
Error
DFt ValuePr > |t|
Intercept102.700.64562159.08<.0001
Month-0.52590.11942-4.410.0478


The random-effects estimates represent the estimated deviation from the mean intercept and slope for each batch (Output 78.5.8). Therefore, the intercept for the first batch is close to , while the intercepts for the other two batches are greater than 102.7. The second batch has a slope less than the mean slope of –0.526, while the other two batches have slopes greater than –0.526.

Output 78.5.8: Random Coefficients Analysis (continued)

Solution for Random Effects
EffectBatchEstimateStd Err PredDFt ValuePr > |t|
Intercept1-1.00100.684278-1.460.1474
Month10.12870.1245781.030.3047
Intercept20.39340.6842780.580.5669
Month2-0.20600.124578-1.650.1021
Intercept30.60760.6842780.890.3772
Month30.077310.1245780.620.5365


The F statistic in the "Type 3 Tests of Fixed Effects" table in Output 78.5.9 is the square of the t statistic used in the test of Month in the preceding "Solution for Fixed Effects" table (compare Output 78.5.7 and Output 78.5.9). Both statistics test the null hypothesis that the slope assigned to Month equals 0, and this hypothesis can barely be rejected at the 5% level.

Output 78.5.9: Random Coefficients Analysis (continued)

Type 3 Tests of Fixed Effects
EffectNum DFDen DFF ValuePr > F
Month1219.410.0478


It is also possible to fit a random coefficients model with error terms that follow a nested structure (Fuller and Battese 1973). The following SAS statements represent one way of doing this:

proc mixed data=rc;
   class Batch Monthc;
   model Y = Month / s;
   random Int Month Monthc / sub=Batch s;
run;

The variable Monthc is added to the CLASS and RANDOM statements, and it models the nested errors. Note that Month and Monthc are continuous and classification versions of the same variable. Also, the TYPE=UN option is dropped from the RANDOM statement, resulting in the default variance components model instead of correlated random coefficients. The results from this analysis are shown in Output 78.5.10.

Output 78.5.10: Random Coefficients with Nested Errors Analysis

The Mixed Procedure

Model Information
Data SetWORK.RC
Dependent VariableY
Covariance StructureVariance Components
Subject EffectBatch
Estimation MethodREML
Residual Variance MethodProfile
Fixed Effects SE MethodModel-Based
Degrees of Freedom MethodContainment

Class Level Information
ClassLevelsValues
Batch31 2 3
Monthc60 1 3 6 9 12

Dimensions
Covariance Parameters4
Columns in X2
Columns in Z per Subject8
Subjects3
Max Obs per Subject28

Number of Observations
Number of Observations Read108
Number of Observations Used84
Number of Observations Not Used24

Iteration History
IterationEvaluations-2 Res Log LikeCriterion
01367.02768461 
14277.51945360.
21276.975517180.00104208
31276.903049090.00003174
41276.901003160.00000004
51276.901000920.00000000

Convergence criteria met.

Covariance Parameter Estimates
Cov ParmSubjectEstimate
InterceptBatch0
MonthBatch0.01243
MonthcBatch3.7411
Residual 0.7969


For this analysis, the Newton-Raphson algorithm requires five iterations and nine likelihood evaluations to achieve convergence. The missing value in the Criterion column in iteration 1 indicates that a boundary constraint has been dropped.

The estimate for the Intercept variance component equals 0. This occurs frequently in practice and indicates that the restricted likelihood is maximized by setting this variance component equal to 0. Whenever a zero variance component estimate occurs, the following note appears in the SAS log:

NOTE: Estimated G matrix is not positive definite.

The remaining variance component estimates are positive, and the estimate corresponding to the nested errors (MONTHC) is much larger than the other two.

A comparison of AIC and BIC for this model with those of the previous model favors the nested error model (compare Output 78.5.11 and Output 78.5.6). Strictly speaking, a likelihood ratio test cannot be carried out between the two models because one is not contained in the other; however, a cautious comparison of likelihoods can be informative.

Output 78.5.11: Random Coefficients with Nested Errors Analysis (continued)

Fit Statistics
-2 Res Log Likelihood276.9
AIC (Smaller is Better)282.9
AICC (Smaller is Better)283.2
BIC (Smaller is Better)280.2


The better-fitting covariance model affects the standard errors of the fixed-effects parameter estimates more than the estimates themselves (Output 78.5.12).

Output 78.5.12: Random Coefficients with Nested Errors Analysis (continued)

Solution for Fixed Effects
EffectEstimateStandard
Error
DFt ValuePr > |t|
Intercept102.560.72872140.74<.0001
Month-0.50030.12592-3.970.0579


The random-effects solution provides the empirical best linear unbiased predictions (EBLUPs) for the realizations of the random intercept, slope, and nested errors (Output 78.5.13). You can use these values to compare batches and months.

Output 78.5.13: Random Coefficients with Nested Errors Analysis (continued)

Solution for Random Effects
EffectBatchMonthcEstimateStd Err PredDFt ValuePr > |t|
Intercept1 0....
Month1 -0.000280.0926866-0.000.9976
Monthc100.21910.7896660.280.7823
Monthc11-2.56900.757166-3.390.0012
Monthc13-2.30670.686566-3.360.0013
Monthc161.87260.7328662.560.0129
Monthc19-1.23500.930066-1.330.1888
Monthc1120.77361.1992660.650.5211
Intercept2 0....
Month2 -0.075710.0926866-0.820.4169
Monthc20-0.006210.789666-0.010.9938
Monthc21-2.21260.757166-2.920.0048
Monthc233.10630.6865664.53<.0001
Monthc262.06490.7328662.820.0064
Monthc29-1.44500.930066-1.550.1250
Monthc212-2.44051.199266-2.040.0459
Intercept3 0....
Month3 0.076000.09268660.820.4152
Monthc301.95740.7896662.480.0157
Monthc31-0.88500.757166-1.170.2466
Monthc330.30060.6865660.440.6629
Monthc360.79720.7328661.090.2806
Monthc392.00590.9300662.160.0347
Monthc3120.0022931.1992660.000.9985


Output 78.5.14: Random Coefficients with Nested Errors Analysis (continued)

Type 3 Tests of Fixed Effects
EffectNum DFDen DFF ValuePr > F
Month1215.780.0579


The test of Month is similar to that from the previous model, although it is no longer significant at the 5% level (Output 78.5.14).