0
$\begingroup$

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

$\endgroup$
1
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Many thanks rvl. I will look into how to programmatically combine the standard errors from the data.frame object. $\endgroup$ – B. Clegg May 18 '16 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$ – rvl May 20 '16 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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