get significance of simple effects with emtrends

折月煮酒 提交于 2019-12-14 02:44:57

问题


I can get the significance of pairwise comparisons with the following code

m <- lmer(angle ~ recipe*temp + (1|replicate), data=cake)
emtrends(m, pairwise~recipe, var="temp")

$emtrends
 recipe temp.trend         SE  df   lower.CL  upper.CL
 A       0.1537143 0.02981898 250 0.09498586 0.2124427
 B       0.1645714 0.02981898 250 0.10584300 0.2232999
 C       0.1558095 0.02981898 250 0.09708110 0.2145379

$contrasts
 contrast     estimate        SE  df t.ratio p.value
 A - B    -0.010857143 0.0421704 250  -0.257  0.9641
 A - C    -0.002095238 0.0421704 250  -0.050  0.9986
 B - C     0.008761905 0.0421704 250   0.208  0.9765

However, what if I'm interested in whether the trend for each recipe is significant on its own? How can I get the significance of the $emtrends?


回答1:


The simplest way is to do

test(emtrends(m, ~recipe, var="temp"))



回答2:


You can get p-values from t-values:

out.emtrends <- emtrends(m, pairwise~recipe, var="temp")
emtr <- as.data.frame(out.emtrends$emtrends)
tvalues <- emtr$temp.trend/emtr$SE
dfs <- emtr$df
(pvalues <- 2*pt(-abs(tvalues), dfs))

# 5.158650e-07 8.514898e-08 3.669655e-07


来源:https://stackoverflow.com/questions/54518034/get-significance-of-simple-effects-with-emtrends

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!