LMIXED Procedure

LSMESTIMATE Statement

  • LSMESTIMATE fixed-effect <'label'> values <divisor=n> <, <'label'> values <divisor=n>> <, …></ options>;

The LSMESTIMATE statement provides a mechanism for performing custom hypothesis tests among the least squares means (LS-means). In contrast to the hypotheses that are tested using the ESTIMATE or CONTRAST statement, the LSMESTIMATE statement enables you to form linear combinations of the LS-means rather than linear combination of fixed-effects parameter estimates and/or random-effects solutions. Multiple-row sets of coefficients are permitted.

Computing an LS-means estimate involves two coefficient matrices. Suppose that the fixed-effect has levels. Then the LS-means are formed as , where is an coefficient matrix. The coefficient matrix is formed from the values that you supply in the k rows of the LSMESTIMATE statement. The LS-means estimates then represent the vector

You can use the ELSM option to display the coefficient matrix and use the E option to display the coefficient matrix .

The LSMESTIMATE statement produces a t test for each row of coefficients that you specify. You can adjust p-values and confidence intervals for multiplicity by specifying the ADJUST= option. You can obtain an F test of single-row or multiple-row LS-means estimates by specifying the FTEST option.

Note that you specify only a single fixed effect in the LSMESTIMATE statement. The row labels are optional and follow the effects specification. For example, the following statements fit a split-plot design and compare the average of the third and fourth LS-mean of the whole-plot factor A to the first LS-mean of the factor:

proc lmixed;
   class a b block;
   model y = a b a*b /  s;
   random int a / sub=block;
   lsmestimate A 'a1 vs avg(a3,a4)' [2, 1] [-1, 3] [-1, 4] divisor=2;
run;

The order in which coefficients are assigned to the LS-means corresponds to the order in which they are displayed in the "Least Squares Means" table. You can use the ELSM option to see how coefficients are matched to levels of the fixed-effect.

The DIVISOR=n specification enables you to assign a separate divisor to each row of the LS-means estimate. You can also use the DIVISOR= option in this statement after a slash (/).

Table 7 summarizes the options available in the LSMESTIMATE statement.

Table 7: LSMESTIMATE Statement Options

Option Description
Construction and Computation of LS-Means
AT Modifies covariate values in computing LS-means
DIVISOR= Specifies a list of values to divide the coefficients
SINGULAR= Tunes the singular criterion for estimability checking
Tests, Adjustment, and p-Values
ADJUST= Determines the method of multiple comparison adjustment of LS-means estimate differences
ALPHA= Determines the confidence level ()
CHISQ Requests a chi-square test in addition to the F test
DF= Assigns a specific value to degrees of freedom for tests and confidence limits
FTEST Produces an F test
LOWER Performs one-sided, lower-tailed inference
UPPER Performs one-sided, upper-tailed inference
Statistical Output
CL Constructs confidence limits for means and mean differences
CORR Displays the correlation matrix of LS-means estimates
COV Displays the covariance matrix of LS-means estimates
E Displays the matrix
ELSM Displays the matrix


You can specify the following options in the LSMESTIMATE statement after a slash (/):

ADJUST=method

performs a multiple comparison adjustment for the p-values and confidence limits for the differences of LS-means estimates. The adjusted quantities are produced in addition to the unadjusted p-values and confidence limits. Adjusted confidence limits are produced if you specify the CL or ALPHA= option. For a description of the adjustments, see the ADJUST= option in the LSMEANS statement.

You can specify the following methods:

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).

SCHEFFE

performs Scheffé’s multiple comparison procedure.

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. For a description of the simoptions (except for the CVADJUST option, which you cannot use in the MARGINS statement), see the ADJUST= option in the LSMEANS statement.

ALPHA=number

constructs a t-type confidence interval for each of the LS-means with confidence level 1 – number. 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 covariate effects 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;
   model Y = A x1 x2 x1*x2;
   lsmestimate A 'a1 vs a2' [1, 1] [-1, 2];
   lsmestimate A 'a1 vs a2' [1, 1] [-1, 2] / at means;
   lsmestimate A 'a1 vs a2' [1, 1] [-1, 2] / at x1=1.2;
   lsmestimate A 'a1 vs a2' [1, 1] [-1, 2] / at (x1 x2)=(1.2 0.3);
run;

For the first two LSMESTIMATE statements, the LS-means coefficient of x1 is (the mean of x1) and of x2 is (the mean of x2). For the first LSMESTIMATE statement, the coefficient of x1*x2 is . However, for the second LSMESTIMATE statement, the coefficient is . The third LSMESTIMATE statement sets the coefficient of x1 equal to 1.2 and leaves it at for x2, and the final LSMESTIMATE 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, 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 check that the modified LS-means coefficients are the ones that you want.

CHISQ

performs chi-square tests in addition to F tests, when you specify the FTEST option.

CL

constructs the t-type confidence limits 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 95% by default, corresponding to the default ALPHA=0.05 option. You can change this by specifying the ALPHA= option.

CORR

displays the estimated correlation matrix of the linear combination of the LS-means.

COV

displays the estimated covariance matrix of the linear combination of the LS-means.

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.

DIVISOR=value-list

specifies a list of values by which to divide the coefficients so that fractional coefficients can be entered as integer numerators. If you do not specify a value-list, a default value of 1.0 is assumed. Missing values in the value-list are converted to 1.0.

If the number of elements in the value-list exceeds the number of rows of the estimate, the extra values are ignored. If the number of elements in the value-list is less than the number of rows of the estimate, the last value in the value-list is carried forward.

If you specify a row-specific divisor as part of the specification of the estimate row, this value multiplies the corresponding value in the value-list. For example, the following statement divides the coefficients in the first row by 8 and the coefficients in the third and fourth rows by 3:

lsmestimate A 'One vs. two'   [8, 1] [-8, 2] divisor=2,
              'One vs. three' [1, 1] [-1, 3]          ,
              'One vs. four'  [3, 1] [-3, 4]          ,
              'One vs. five'  [3, 1] [-3, 5]           / divisor=4,.,3;

Coefficients in the second row are not altered.

E

displays the coefficients of the estimable function. These are the coefficients that apply to the fixed-effects parameter estimates. The E option displays the coefficients that you would need to enter in an equivalent ESTIMATE statement.

ELSM

displays the matrix coefficients. These are the coefficients that apply to the LS-means. This option is useful to ensure that you assigned the coefficients correctly to the LS-means.

FTEST
JOINT

produces an F test that jointly tests the rows of the LSMESTIMATE against zero. If you specify the LOWER or UPPER options, the LMIXED procedure computes a simulation-based p-value for the constrained joint test.

LOWER
LOWERTAILED

requests that the p-value for the t test be based only on values that are less than the test statistic. A two-tailed test is the default. A lower-tailed confidence limit is also produced if you specify the CL or ALPHA= option.

Note that for ADJUST=SCHEFFE the one-sided adjusted confidence intervals and one-sided adjusted p-values are the same as the corresponding two-sided statistics, because this adjustment is based on only the right tail of the F distribution.

If you specify the FTEST option, then a one-sided left-tailed order restriction is applied to all estimable functions.

SINGULAR=number

tunes the singular criterion for estimability checking.

UPPER
UPPERTAILED

requests that the p-value for the t test be based only on values that are greater than the test statistic. A two-tailed test is the default. An upper-tailed confidence limit is also produced if you specify the CL or ALPHA= option.

Note that for ADJUST=SCHEFFE the one-sided adjusted confidence intervals and one-sided adjusted p-values are the same as the corresponding two-sided statistics, because this adjustment is based on only the right tail of the F distribution.

If you specify the FTEST option, then a one-sided right-tailed order restriction is applied to all estimable functions.

Last updated: May 14, 2026