How can I test for a significant difference between a pair of least squares means, when each member of the pair comes from a different generalized linear mixed-effects model? The models were constructed using the glmer() function of the lme4 package of R, and the least squares means calculated from the model outputs using the lsmeans() package. The lsmeans package outputs estimates, standard errors and asymptotic upper and lower 95 % confidence intervals for each lsmean, but Df are not available (because results are asymptotic?).


1 Answer 1


By "separate models," I am assuming that the lsmeans from those models are independent of one another. If that is the case, then you can apply the Pythagorean theorem:

$$SE(m_i-m_j) = \sqrt{SE^2(m_i)+SE^2(m_j)}$$

In the lsmeans package, the summary function produces a data.frame object from which you can programmatically combine the needed standard errors.

  • $\begingroup$ Many thanks rvl. I will look into how to programmatically combine the standard errors from the data.frame object. $\endgroup$
    – B. Clegg
    Commented May 18, 2016 at 13:55
  • $\begingroup$ It'll be a different data.frame for each model, so maybe you want to combine them using rbind and create a new column for which model it is. $\endgroup$
    – Russ Lenth
    Commented May 20, 2016 at 21:02

Your Answer

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

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