0

If I perform a linear-mixed effects model using lsmeans, like this:

 model <- lmer (variable ~ A * B + (1|C), data = data)

Where I found a significant main effect of "A", which has three levels. Then I performed a post-hoc test to compare the three levles using "lsmeans" package:

lsmeans (model, pairwise~A, adjust = "Tukey")

I am wondering does this post-hoc comparison also take the random factor "C" into consideration when comparing the levels of A?

Ping Tang
  • 415
  • 1
  • 9
  • 20
  • lsmeans gets the pairwise comparisons from the model. Depending on what you mean by "take into consideration" that's a yes. – Roland Sep 24 '16 at 06:34
  • `lsmeans` uses the fixed effects, `fixef()` to derive its predictions, and the covariance matrix of those, `vcov()` to derive SEs of those predictions. The latter incorporates variations due to the random effects. Thus, in your specific example, variations in `C` contribute to the standard errors, the LS means themselves depend only on the effects of `A` and `B`. – Russ Lenth Sep 25 '16 at 16:15

0 Answers0