自定义与emmeans的对比

问题描述

我想计算因子水平的特定对比(即1_1与3_3和1_3与3_1),但是不确定是否正确。

我猜想,当我运行plot()函数时,它看起来像一个pair()函数计算(此处未显示eff_size(contr)的函数)。而如果我绘制“ post”对象,它将给我所需的绘制,但与“ contr”对象的p值(如下)相比,p值错误

非常感谢

post <- emmeans(fit,specs = contr ~ Condition,pbkrtest.limit = 4959)

 Condition emmean     SE   df lower.CL upper.CL
 1_1         6.77 0.0304 85.2     6.71     6.83
 3_3         6.81 0.0304 85.1     6.75     6.87
 1_3         6.88 0.0305 86.0     6.82     6.94
 3_1         6.88 0.0305 85.8     6.82     6.95

degrees-of-freedom method: kenward-roger 
Confidence level used: 0.95 

levels(df$Condition)
[1] "1_1" "3_3" "1_3" "3_1"

c1_1 <- c(1,0)
c3_3 <- c(0,1,0)
c1_3 <- c(0,0)
c3_1 <- c(0,1)

contr <- contrast(post,method = list("1_1 - 3_3" = c1_1 - c3_3,"3_3 - 3_1" = c3_3 - c3_1),adjust = "bonferroni")
contr
 contrast  estimate     SE   df t.ratio p.value
 1_1 - 3_3  -0.0408 0.0164 74.4 -2.490  0.0300 
 3_3 - 3_1  -0.0776 0.0165 76.2 -4.708  <.0001 

plot(contr,comparisons = T)

pairs(contr)
 contrast              estimate     SE   df t.ratio p.value
 1_1 - 3_3 - 3_3 - 3_1   0.0368 0.0284 75.1 1.294   0.1996 

degrees-of-freedom method: kenward-roger 

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)