![]() | ![]() | ![]() | ![]() |
/* generate sample data. */ data check; seed = 213845740; do v1 = 1 to 2; do n = 1 to 20; x1 = ranuni(seed); y = v1 + x1 + rannor(seed); output; end; end; run; proc mixed data=check; class v1; model y = v1 x1 v1*x1 / solution e3; lsmeans v1 / pdiff e; run;
Here are the results from the SOLUTION option:
Solution for Fixed Effects Standard Effect v1 Estimate Error DF t Value Pr > |t| Intercept 2.3605 0.3681 36 6.41 <.0001 v1 1 -1.7722 0.5554 36 -3.19 0.0029 v1 2 0 . . . . x1 0.3744 0.7303 36 0.51 0.6113 x1*v1 1 1.3046 1.0224 36 1.28 0.2101 x1*v1 2 0 . . . .
To interpret the estimates, note that the CLASS statement in PROC MIXED (and PROC GLM) sets up an overparameterized model by using one dummy variable for each level of a class effect. This parameterization causes one level of the CLASS variable (whether it is the default, the last ordered, or the highest ordered) to be set to zero. The other parameters for the CLASS variables are interpreted as differences between that level and the last level. For instance, the -1.7722 above for V1 level 1 is really the difference between level 1 and level 2 of V1. So, the test on V1 level 1 is a test of the difference between those two levels of V1. The INTERCEPT value is actually the estimate for the last level of V1, making the estimate for V1 level 1 equal to 2.3605 - 1.7722.
A similar interpretation is used for the interaction term. The estimate for X1 is actually the estimate for X1*V1 level 2, while the estimate for X1*V1 is an estimate of the difference in the slopes of X1 across the two levels of V1.
Here are the Type 3 tests:
Type 3 Tests of Fixed Effects Num Den Effect DF DF F Value Pr > F v1 1 36 10.18 0.00 x1 1 36 4.03 0.05 x1*v1 1 36 1.63 0.21
These results can be hard to understand if you are not familiar with Type 3 tests. To help understand the tests, the E3 option shows exactly how each Type 3 test is formed. For V1, this is what the E3 option shows:
Type 3 Coefficients for v1 Effect v1 Row1 Intercept v1 1 1 v1 2 -1 x1 x1*v1 1 x1*v1 2
The coefficients on V1, the 1 and -1, show that the Type 3 test is testing a difference in the levels of V1. This is the same test you get in the SOLUTION output for V1.
For X1, this is what the E3 option shows:
Type 3 Coefficients for x1 Effect v1 Row1 Intercept v1 1 v1 2 x1 1 x1*v1 1 0.5 x1*v1 2 0.5
This implies that the Type 3 test is testing that the average slope of X1 across the two levels of V1 is equal to zero. We do not get a similar test by the SOLUTION option. Recall that the test on X1 by the SOLUTION option is a test that the slope on X1 for the second level of V1 is zero.
For X1*V1, this is what the E3 option shows:
Type 3 Coefficients for x1*v1 Effect v1 Row1 Intercept v1 1 v1 2 x1 x1*v1 1 1 x1*v1 2 -1
This is a test of the equality of the slopes on X1 across the two levels of V1. This is the same test we get in the SOLUTION output.
Here are the results of the LSMEANS statement with the PDIFF option:
Differences of Least Squares Means Standard Effect v1 _v1 Estimate Error DF t Value Pr > |t| v1 1 2 -1.1531 0.2721 36 -4.24 0.0001
This result is different from the test on V1 in either the SOLUTION output or Type 3 tests output. The E option in the LSMEANS statement shows why:
Coefficients for v1 Least Squares Means Effect v1 Row1 Row2 Intercept 1 1 v1 1 1 v1 2 1 x1 0.4745 0.4745 x1*v1 1 0.4745 x1*v1 2 0.4745
The Type 3 test of V1 tests the difference in the two levels of V1 assuming that the value of X1 is zero. The test of the V1 LSMEAN tests the difference in the two levels of V1 at the mean value of the covariate, X1, of .4745. Because the slopes of X1 are different across the two levels of V1, you will get a different test depending on the value of X1 that is used. This difference causes some statisticians to mean-center their covariates before running an analysis. If the mean value of the covariate is zero, then these test results will agree.
All of the above hypothesis tests could be of interest, but they do test different things. By understanding how the model is parameterized and using the E3 and E options, you can see exactly what tests are performed.
Product Family | Product | System | SAS Release | |
Reported | Fixed* | |||
SAS System | SAS/STAT | All | n/a |
Type: | Usage Note |
Priority: | low |
Topic: | Analytics ==> Mixed Models SAS Reference ==> Procedures ==> MIXED |
Date Modified: | 2016-06-01 17:18:13 |
Date Created: | 2004-02-13 15:36:13 |