LMIXED Procedure
LSMEANS Statement
LSMEANS fixed-effects </ options>;
The LSMEANS statement computes least squares means (LS-means) of classification fixed effects. As in the GLM procedure, LS-means are predicted population margins—that is, they estimate the marginal means over a balanced population. In a sense, LS-means are to unbalanced designs as classification and subclassification arithmetic means are to balanced designs. The matrix constructed to compute them is the same as the
matrix formed in PROC GLM; however, the standard errors are adjusted for the covariance parameters in the model.
Each LS-mean is computed as , where
is the coefficient matrix associated with the least squares mean and
is the estimate of the fixed-effects parameter vector. The approximate standard errors for the LS-mean is computed as the square root of
.
LS-means can be computed for any effect in the MODEL statement that involves CLASS variables. You can specify multiple effects in one LSMEANS statement or in multiple LSMEANS statements, and all LSMEANS statements must appear after the MODEL statement. As in the ESTIMATE statement, the matrix is tested for estimability, and if this test fails, PROC LMIXED displays "Non-est" for the LS-means entries.
Assuming the LS-mean is estimable, PROC LMIXED constructs an approximate t test to test the null hypothesis that the associated population quantity equals zero. By default, the denominator degrees of freedom for this test are the residual degrees of freedom.
Table 6 summarizes the options available in the LSMEANS statement.
Table 6: LSMEANS Statement Options
| Option | Description |
|---|---|
| ADJUST= | Determines the method of multiple comparison adjustment of LS-means differences |
| ALPHA= | Specifies the confidence level |
| AT= | Modifies covariate values in computing LS-means |
| CL | Constructs t-type confidence limits |
| CORR | Displays the estimated correlation matrix |
| COV | Displays the estimated covariance matrix |
| DF= | Specifies the degrees of freedom |
| DIFF | Displays the differences of the LS-means |
| E | Displays the matrix coefficients for LSMEANS effects |
| SINGULAR= | Tunes the estimability checking |
| SLICE= | Partitions interaction LSMEANS effects |
| STEPDOWN | Adjusts multiple comparison p-values further through a step-down adjustment process |
You can specify the following options in the LSMEANS statement after a slash (/).
- ADJUST=method
-
requests a multiple comparison adjustment for the p-values and confidence limits for the differences of LS-means. The adjusted quantities are produced along with the unadjusted quantities. The ADJUST= option works together with the DIFF option. If you omit the DIFF option, then the ADJUST= option implies the DIFF option except for ADJUST=T.
You can specify the following methods for the ADJUST= option:
- BON
performs Bonferroni t tests of differences between LS-means. The method involves correction factors described in Chapter 53, The GLM Procedure (SAS/STAT User's Guide), and Chapter 86, The MULTTEST Procedure (SAS/STAT User's Guide); also see Westfall and Young (1993) and Westfall et al. (1999).
- DUNNETT
performs Dunnett’s t test, testing whether any treatments are significantly different from a single control for the effects in the LSMEANS statement. If the LS-means are correlated, PROC LMIXED uses the factor-analytic covariance approximation described in Hsu (1992) and identifies the adjustment as "Dunnett-Hsu" in the results. The approximation derives approximate "effective sample sizes" for which exact critical values are computed.
- NELSON
performs Nelson’s t test of each LS-mean against an average of the LS-means (Ott 1967; Nelson 1982, 1991, 1993). When the LS-means are correlated, PROC LMIXED uses the factor-analytic covariance approximation described in Hsu (1992) and identifies the adjustment as "Nelson-Hsu" in the results. The approximation derives approximate "effective sample sizes" for which exact critical values are computed.
- SCHEFFE
- SIDAK
performs pairwise t tests on differences between LS-means with levels adjusted according to Šidák’s inequality. The method involves correction factors described in Chapter 53, The GLM Procedure (SAS/STAT User's Guide), and Chapter 86, The MULTTEST Procedure (SAS/STAT User's Guide); also see Westfall and Young (1993) and Westfall et al. (1999).
- SIMULATE <(simoptions)>
-
performs the simulation-based multiple comparison procedure. This method computes adjusted p-values and confidence limits from the simulated distribution of the maximum or maximum absolute value of a multivariate t random vector. All covariance parameters, except the residual scale parameter, are fixed at their estimated values throughout the simulation, potentially resulting in some underdispersion. The simulation estimates q, the true
quantile, where
is the confidence coefficient. The default value of
is 0.05; you can change this value by specifying the ALPHA= option in the LSMEANS statement.
The number of samples is set so that the tail area for the simulated q is within
of
with
% confidence. In equation form,
where
is the simulated q and F is the true distribution function of the maximum; see Edwards and Berry (1987) for details. By default,
= 0.005 and
= 0.01, placing the tail area of
within 0.005 of 0.95 with 99% confidence.
You can specify the following simoptions in parentheses after the ADJUST=SIMULATE option:
- ACC=value
specifies the target accuracy radius
of a
% confidence interval for the true probability content of the estimated
quantile. By default, ACC=0.005. Note that, if you also specify the CVADJUST simoption, then the actual accuracy radius will probably be substantially less than this target.
- CVADJUST
specifies that the quantile be estimated by the control variate adjustment method of Hsu and Nelson (1998) instead of simply as the quantile of the simulated sample. Specifying this option usually has the effect of significantly reducing the accuracy radius
of a
% confidence interval for the true probability content of the estimated
quantile. The control-variate-adjusted quantile estimate takes approximately twice as long to compute, but it is typically much more accurate than the sample quantile.
- EPS=value
specifies the value
for a
% confidence interval for the true probability content of the estimated
quantile. The default value of the accuracy confidence is 99%, corresponding to EPS=0.01.
- NSAMP=n
specifies the sample size for the simulation. By default, n is set by a formula that is based on the values of the target accuracy radius
and accuracy confidence
% for an interval for the true probability content of the estimated
quantile. When the default values are used for
,
, and
(0.005, 0.01, and 0.05, respectively), NSAMP=12605.
- REPORT
specifies that a report on the simulation be displayed, including a listing of the parameters, such as
,
, and
, as well as an analysis of various methods of estimating or approximating the quantile.
- SEED=number
specifies an integer to be used to start the pseudorandom number generator for the simulation. If you do not specify a seed, or if you specify a number less than or equal to 0, the seed is generated by reading the time of day from the computer’s clock.
- SMM | GT2
performs pairwise comparisons based on the studentized maximum modulus and Šidák’s uncorrelated-t inequality, yielding Hochberg’s GT2 method when sample sizes are unequal.
- T | NONE
performs no adjustment for multiple comparisons.
- TUKEY
performs Tukey’s studentized range test on LS-means. When your data are unbalanced, PROC LMIXED uses the approximation described in Kramer (1956) and identifies the adjustment as "Tukey-Kramer" in the results.
By default, ADJUST=T | NONE.
If you specify ADJUST=DUNNETT, the procedure analyzes all differences with the first control level unless you have specified different control level. If you specify ADJUST=NELSON, then DIFF=ANOM is assumed.
If you specify ADJUST=TUKEY, then DIFF=ALL is assumed. If you specify other methods, then the procedure performs all pairwise differences unless you specify the DIFF option.
Note that computing the exact adjusted p-values and critical values for unbalanced designs can be computationally intensive, especially for ADJUST=NELSON.
- ALPHA=number
requests that a t-type confidence interval be constructed for each of the LS-means with confidence level
. The value of number must be between 0 and 1; the default is 0.05.
- AT at-specification
-
enables you to modify the values of the covariates that are used in computing LS-means. By default, all covariates are set equal to their mean values for computing standard LS-means. The AT option enables you to assign arbitrary values to the covariates. Additional columns in the output table indicate the values of the covariates.
You can specify the following at-specifications:
- MEANS
sets covariates equal to their mean values (as with standard LS-means) and applies this adjustment to crossproducts of covariates.
- variable=value
sets the covariate variable equal to value.
- (variable-list)=(value-list)
sets covariates in the variable-list equal to values in the value-list.
As an example, consider the following invocation of PROC LMIXED:
proc lmixed; class A B; model Y = A*B x1 x2 x1*x2; LSMEANS A*B; LSMEANS A*B / at means; LSMEANS A*B / at x1=1.2; LSMEANS A*B / at (x1 x2)=(1.2 0.3); run;For the first two LSMEANS statements, the LS-means coefficient of
x1is(the mean of
x1) and ofx2is(the mean of
x2). For the first LSMEANS statement, the coefficient ofx1*x2is. However, for the second LSMEANS statement, the coefficient is
. The third LSMEANS statement sets the coefficient of
x1equal to 1.2 and leaves it atfor
x2, and the final LSMEANS statement sets these values to 1.2 and 0.3, respectively.Even if you specify a WEIGHT variable, the unweighted covariate means are used for the covariate coefficients if you omit the AT option. If you specify the AT option, then WEIGHT or FREQ variables are taken into account as follows. The weighted covariate means are used for the covariate coefficients for which no explicit AT option values are given, or if you specify the AT MEANS option. Observations that do not contribute to the analysis because of a missing dependent variable are used in computing the covariate means. You should use the E option in conjunction with the AT option to verify that the modified LS-means coefficients are the ones that you want.
- CL
requests that t-type confidence limits be constructed for each of the LS-means. If DDFM=NONE, then PROC LMIXED uses infinite degrees of freedom for this test, essentially computing a z interval. The confidence level is 0.95 by default; this can be changed with the ALPHA= option. If you specify an ADJUST= option, then the confidence limits are adjusted for multiplicity. If you also specify the STEPDOWN option, then only p-values, not the confidence limits, are step-down-adjusted.
- CORR
displays the estimated correlation matrix of the least squares means as part of the "Least Squares Means" table.
- COV
displays the estimated covariance matrix of the least squares means as part of the "Least Squares Means" table.
- DF=number
specifies the degrees of freedom for the t test and confidence limits. The default is the residual degrees of freedom that you define by specifying the DDFM=RESIDUAL option.
-
DIFF<=difftype>
PDIFF<=difftype> -
requests that differences of the LS-means be displayed. You can specify the following values for the optional difftype.
- ALL
requests all pairwise differences.
- ANOM
requests differences between each LS-mean and the average LS-mean, as in the analysis of means (Ott 1967). The average is computed as a weighted mean of the LS-means, with the weights being inversely proportional to the diagonal entries of the
matrix. When a WEIGHT statement is specified, then the preceding matrix is replaced with
where
is the diagonal matrix that contains the weights. If LS-means are nonestimable, this design-based weighted mean is replaced with an equally weighted mean. Note that the ANOM procedure in SAS/QC software implements both tables and graphics for the analysis of means with a variety of response types. For one-way designs and normally distributed data, the DIFF=ANOM computations are equivalent to the results of PROC ANOM.
- CONTROL
-
requests differences with a control; by default, the control is the first level of each of the specified LSMEANS effects. To specify which levels of the effects are the controls, list the quoted formatted values in parentheses after the CONTROL keyword. For example, if the effects
A,B, andCare classification variables, each having two levels, 1 and 2, the following LSMEANS statement specifies the (1,2) level ofA*Band the (2,1) level ofB*Cas controls:lsmeans A*B B*C / diff=control('1' '2', '2' '1');For multiple effects, the results depend upon the order of the list, and so you should check the output to make sure that the controls are correct.
CONTROL produces two-tailed tests and confidence limits.
- CONTROLL
requests one-tailed results and tests whether the noncontrol levels are significantly smaller than the control. The upper confidence limits for the control minus the noncontrol levels are considered to be infinity and are displayed as missing.
- CONTROLU
requests one-tailed results and tests whether the noncontrol levels are significantly larger than the control. The upper confidence limits for the noncontrol levels minus the control are considered to be infinity and are displayed as missing.
The differences of the LS-means are displayed in a table titled "Differences of Least Squares Means." The table name is "Diffs."
- E
requests that the matrix coefficients for all LSMEANS effects be displayed. The name of this "Matrix Coefficients" table is "Coef."
- PDIFF
is the same as the DIFF option.
- SINGULAR=number
tunes the estimability checking as documented for the SINGULAR= in the CONTRAST statement.
-
SLICE=fixed-effect | (fixed-effects)
SLICEBY=fixed-effect | (fixed-effects) -
specifies effects by which to partition interaction LSMEANS effects. This can produce what are known as tests of simple effects (Winer 1971). For example, suppose that
A*Bis significant, and you want to test the effect ofAfor each level ofB. The appropriate LSMEANS statement islsmeans A*B / slice=B;This statement tests for the simple main effects of
AforB, which are calculated by extracting the appropriate rows from the coefficient matrix for theA*BLS-means and by using them to form an F test.The SLICE= option produces F tests that test the simultaneous equality of cell means at a fixed level of the slice effect (Schabenberger, Gregoire, and Kong 2000).
The SLICE= option produces a table titled "Tests of Effect Slices." The table name is "Slices."
- STEPDOWN<(step-down-options)>
-
performs a further step-down adjustment to the multiple-comparison-adjusted p-values for differences of LS-means. Specifically, the ADJUST= option in the LSMEANS statement performs a multiple comparison adjustment for the p-values and confidence limits that are associated with differences of LS-means. When you specify the STEPDOWN option, PROC LMIXED applies an additional adjustment to these multiple-comparison-adjusted p-values. Step-down methods increase the power of multiple comparisons by taking advantage of the fact that a p-value will never be declared significant unless all smaller p-values are also declared significant.
You must specify the ADJUST= option when you specify the STEPDOWN option in the LSMEANS statement.
The STEPDOWN option affects only p-values, not confidence limits.
You can specify the following step-down-options in parentheses:
- MAXTIME=n
specifies an upper limit of n seconds to compute the maximal logically consistent sequential subsets of equality hypotheses when you specify the TYPE=LOGICAL option. The default is 60 seconds. Step-down adjustments require substantial computation time when you have a large number of LS-means comparisons, such as all pairwise comparisons when the number of groups exceeds 10. In such cases, it is recommended that you use the TYPE=FREE or TYPE=LOGICAL(n) option with a small value of n.
- REPORT
displays the report of the step-down adjustment, including a list of the sequential subsets (Westfall 1997). When you specify the STEPDOWN option along with the ADJUST=SIMULATE option, the report also includes the step-down simulation results.
- TYPE=LOGICAL<(n)> | FREE
-
specifies the type of step-down adjustment method. By default, TYPE=FREE. You can specify the following method types:
- TYPE=FREE
performs step-down adjustments in which sequential subsets are computed without considering the logical constraints.
- TYPE=LOGICAL(n)
performs step-down adjustments on the basis of maximal logically consistent sequential subsets of equality hypotheses (Shaffer 1986; Westfall 1997). Because considering all logical constraints can be computationally intensive, you can limit the depth of the search tree by specifying a nonnegative integer n. If you omit n or if n = –1, the full search tree is used.
The TYPE=FREE option results are more conservative than the TYPE=LOGICAL option results, but they are generally more efficient in computing step-down adjustments when you have a large number of comparisons. For example, it is not feasible to take logical constraints between all pairwise comparisons when the number of groups exceeds 10. As with TYPE=FREE, results for TYPE=LOGICAL(n) are more conservative than the true TYPE=LOGICAL results, but even for TYPE=LOGICAL(0) they can be appreciably less conservative than the TYPE=FREE results, and they are computationally feasible for much larger numbers of comparisons.
When you specify the STEPDOWN option along with the ADJUST=BON option, the method of Holm (1979) is used if TYPE=FREE, and "Method 2" of Shaffer (1986) is used if TYPE=LOGICAL.
When you specify the STEPDOWN option along with the ADJUST=SIMULATE option, the method of Westfall (1997) is used, where the generalized least squares hybrid approach is used to increase Monte Carlo accuracy.