I have recently learned about LS means (estimated marginal means, predicted marginal means) and I am trying to understand what they could be used for and under what circumstances.

For concreteness, consider a dependent variable $y$ and two categorical independent variables, $x_1$ with two categories and $x_2$ with three categories. One could create dummy variables corresponding to these categories and call them $d_{1,1}, d_{1,2}$ and $d_{2,1}, d_{2,2}, d_{2,3}$. One could then have a linear model (without interaction terms) $$ y = \beta_0 + \beta_{1,2} d_{1,2} + \beta_{2,2} d_{2,2} + \beta_{2,3} d_{2,3} + \varepsilon $$ where $d_{1,1}$ and $d_{2,1}$ are the reference categories. LS means for $x_1$ would be \begin{align} \bar y_{1,1} &= \beta_0 &+ \frac{1}{3}(\beta_{2,2} + \beta_{2,3}), \\ \bar y_{1,2} &= \beta_0 + \beta_{1,2} &+ \frac{1}{3}(\beta_{2,2} + \beta_{2,3}). \\ \end{align}

Uses I can think of
Given $x_1$ and $x_2$, the best (in MSE sense) prediction of $y$ is $\beta_0 + \beta_{1,2} d_{1,2} + \beta_{2,2} d_{2,2} + \beta_{2,3} d_{2,3}$. This is also the expected result after treatment if $x_1$ and/or $x_2$ are interpreted as levels of treatment.
Given $x_1$ alone, the best prediction of $y$ is $\frac{1}{n}\sum_{i=1}^n y_i \mathbb{1}_{d_j=1}$ for $x_1$ being in the category $j$. This is also the expected result after treatment if $x_1$ are interpreted as levels of treatment.
None of these two coincides with $\bar y_{1,1}$ or $\bar y_{1,2}$.
I get that

Least-squares means [are] predictions from a model over a regular grid, averaged over zero or more dimensions

(which is the Wiki excerpt for the tag), but is what is the practical use of that?
So far I can see only one situation in which this could be useful; this is if we know that in population the proportion of observations that have $d_{i,j}=1$ and $d_{k,l}=1$ is the same for all combinations of $i,j,k,l$. Is that the intended use of LS means? Or can it be useful for description or hypothesis testing?

  • $\begingroup$ I guess that this answer, stats.stackexchange.com/a/162093/164061 , explaining lsmeans in a very concise way, also provides a very good reason to use these means. You make use of lsmeans when you wish to control for covariates. $\endgroup$ Mar 10, 2018 at 12:59
  • 1
    $\begingroup$ In this question ( stats.stackexchange.com/questions/308556/… ) a person desires some interpretation for the 4 coefficients in a 2x2 model (with cross terms). The summation of the coefficients provides an intuitive interpretation of the outcome of the model. I guess that the LS means do something similar for the case without the cross-term and only main-effects. The LS means solve the problem/question of presenting the model values in a way that is more easy to interpret (the scale is more intuitive). $\endgroup$ Mar 10, 2018 at 14:34
  • 1
    $\begingroup$ I often model y ~ 0 + x instead of y ~ 1 + x because I find this intercept term in place of a variable term annoying. $\endgroup$ Mar 10, 2018 at 14:35
  • 3
    $\begingroup$ @MartijnWeterings, but the only valid interpretation (AFAIK) is under the assumption that the each category is equally likely in population. Otherwise it is misleading rather than easy to interpret, IMHO. You want effect size? Go for the regression coefficients. You want expected values given just one predictor? Go for conditional means. In this perspective, what question would the LS means be an answer to? $\endgroup$ Mar 10, 2018 at 14:35
  • 3
    $\begingroup$ I agree it is misleading. One could still correct for the unequal distribution, but indeed it remains misleading. It is after all a fictitious value, some artificial construction of combining different groups. Still going back to my initial comment: I don't think that the LS means are so much in use as an alternative expression of the regression coefficients, but more as an alternative to group means (correcting for correlating covariates). $\endgroup$ Mar 10, 2018 at 14:40

1 Answer 1


I disagree strongly with the "only situation" in the OP. EMMs (estimated marginal means, more restrictively known as least-squares means) are very useful for heading off a Simpson's paradox situation in evaluating the effects of a factor. In your example, consider a scenario where these three things are true:

  • When $x_2$ is held at any fixed level, the lowest mean response occurs at $x_1=1$.
  • For $x_1$ held fixed at either level, the highest mean response occurs when $x_2=3$.
  • The combination $(x_1=1, x_2=3)$ has a disproportionately large sample size, while $(x_1=1,x_2=1)$ and $(x_1=1,x_2=2)$ have small sample sizes.

Then it is possible that the marginal mean of $x_1$ is higher than that for $x_2$, even though the mean for $x_1=1$ is less than that for $x_1=2$ for each $x_2$.

If one instead computes EMMs, the observed means at $x_1=1$ and $x_2=1,2,3$ receive equal weight, so that the EMM for $x_1=1$ is less than that for $x_1=2$.

EMMs are comparable to what is termed "unweighted means analysis" in old experimental design texts. The idea was useful many decades ago, and it still is.

The "basics" vignette for the R package emmeans has a concrete illustration and some discussion of such issues.


I have spent the last 5 years or so developing/refining R packages for such purposes, so I'm not exactly an objective observer. I hope to hear other perspectives.

  • 1
    $\begingroup$ Thank you for your answer. I am genuinely curious and I do not wish to imply that there is only one situation where LS means are useful. To the contrary, it is the only situation I could come up with independently, and that is it. That is also why I am asking the question. I am now trying to understand your main argument, and the source you refer to is very helpful. Therefore, +1. EMMs <...> are very useful for heading off a Simpson's paradox situation in evaluating the effects of a factor. For one, the regression coefficients are a great way for evaluating the effects of a factor. ... $\endgroup$ Mar 10, 2018 at 12:09
  • 1
    $\begingroup$ ...Meanwhile, EMMs seem to take this one step forward into a fantasy land (sorry about strong the wording) where the proportion of observations in each category is equal in population. The regression coefficients are straightforward to interpret while the EMMs reflect conditional means of some fictitious population which is different from the one we are dealing with (except when it is not). I could understand the use of EMMs minus the intercept, but it is a bit harder to justify EMMs when the intercept is included. I guess I should not be ranting like that, though :) Once again, thanks! $\endgroup$ Mar 10, 2018 at 12:10
  • 1
    $\begingroup$ I invite you to try an example fitting a model with the default parameterization contr.treatment, and then using EMMs and pairwise comparisons. The regression coefficients then estimate comparisons between certain cases. Compare those to the corresponding pairwise comparisons of EMMs. Then notice that you can get all the comparisons easily from the EMMs, whereas you get only some of them from the regression coefficients. The more factors are involved, the less useful the regression coefficients become. $\endgroup$
    – Russ Lenth
    Mar 10, 2018 at 12:59
  • 3
    $\begingroup$ My basic problem remains that this object does not seem to be an answer to any interesting question. Useless objects are typically neither discussed nor even reported, but this one is, suggesting it is not useless. What I am trying to find out is, what use it could have. The uses I have seen so far do not seem to be of any practical interest. Just to note, my intention is not to bash LS means but to understand why they were created. So far I am failing at this. Perhaps Brian Ripley and I just think alike :) $\endgroup$ Mar 11, 2018 at 14:20
  • 2
    $\begingroup$ Suppose you do a controlled experiment and collect 5 observations at each combination of two factors. Then you compute the marginal means. Are you comfortable with that? And what population are you making an inference for? Didn’t you define this population by your choice of factor levels and by your choice to run a balanced experiment? $\endgroup$
    – Russ Lenth
    Mar 11, 2018 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.