R lsmeans调整多重比较 [英] R lsmeans adjust multiple comparison
问题描述
我使用lme4在R中运行混合效果logistig回归(通过调用glmer),现在我试图进行事后比较.因为它们是成对的,所以Tukey应该没问题,但是我想手动调整应该进行的测试数量-现在可以进行12个测试,但是我只对6个比较感兴趣.
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
推荐答案
肯定有一个原因,您只想对6个比较进行调整,我想这是因为您想细分比较有条件地在因素之一上做.使用lsmeans
很容易做到:
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")
或
lsmeans(logmixed_ranks[[i]],
pairwise ~ indicator_var | rating_ranks, adjust = "tukey")
如果使用adjust = "mvt"
,则将获得与glht
的单步过程完全相同的调整.因此,我相信lsmeans
不支持的唯一glht
功能是多步骤测试.
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.
为什么要列出一个glmer
对象的列表使我感到困惑,但这似乎与我的答案没有关系.
I'm puzzled by why you have a list of glmer
objects, but that does not seem germane to my answer.
这篇关于R lsmeans调整多重比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!