问题
I used lme4 to run a mixed effects logistig regression (by calling glmer) in R and now I am trying to do post-hoc comparisons. As they are pairwise, Tukey should be OK,but I would like to manually adjust for how many tests the correction should be made - now it is made for 12 tests, but I am only intersted in 6 comparisons.
My code looks like this so far
for (i in seq_along(logmixed_ranks)) {
print(lsmeans(logmixed_ranks[[i]], pairwise~rating_ranks*indicator_var, adjust="tukey"))
}
Somehow I may need to use the following but I am not sure how.
p.adjust(p, method = p.adjust.methods, n = length(p))
Can anybody help? Thanks! Laura
回答1:
There must be a reason you want to adjust for only 6 comparisons, and I'm guessing is it is because you want to break down the comparisons you're doing conditionally on one of the factors. This is easy to do using lsmeans
:
lsmeans(logmixed_ranks[[i]],
pairwise ~ rating_ranks | indicator_var, adjust = "tukey")
or
lsmeans(logmixed_ranks[[i]],
pairwise ~ indicator_var | rating_ranks, adjust = "tukey")
By the way, if you use adjust = "mvt"
, you will obtain exactly the same adjustments that glht
uses for its single-step procedure. So I believe the only glht
features not supported by lsmeans
are the multi-step tests.
I'm puzzled by why you have a list of glmer
objects, but that does not seem germane to my answer.
来源:https://stackoverflow.com/questions/29010390/r-lsmeans-adjust-multiple-comparison