mypw.emmc = function(..., sigma = 1) {
result = emmeans:::pairwise.emmc (...)
for (i in seq_along(result[1, ]))
result[[i]] = result[[i]] / sigma
result
}
> emmeans(fit, mypw ~ sex, sigma = 9.246, name = "effect.size")
NOTE: Results may be misleading due to involvement in interactions
$emmeans
sex emmean SE df lower.CL upper.CL
female 63.8 0.434 3.03 62.4 65.2
male 74.5 0.809 15.82 72.8 76.2
other 68.8 1.439 187.08 65.9 71.6
Results are averaged over the levels of: favorite.pirate
Degrees-of-freedom method: kenward-roger
Confidence level used: 0.95
$contrasts
effect.size estimate SE df t.ratio p.value
female - male -1.158 0.0996 399 -11.624 <.0001
female - other -0.537 0.1627 888 -3.299 0.0029
male - other 0.621 0.1717 981 3.617 0.0009
Results are averaged over the levels of: favorite.pirate
Degrees-of-freedom method: kenward-roger
P value adjustment: tukey method for comparing a family of 3 estimates
library(yarrr)
View(pirates)
library(lme4)
library(lmerTest)
fit <- lmer(weight~ favorite.pirate * sex +(1|college), data = pirates)
anova(fit, ddf = "Kenward-Roger")
post <- emmeans(fit, pairwise~ sex)
post
2条答案
按热度按时间jq6vz3qz1#
没有内置的效果大小计算的规定,但您可以通过定义一个自定义对比度函数将每个成对比较除以sigma值来拼凑一个:
下面是一个测试运行:
使用您的模型,误差SD为9.246(请看
summary(fit)
;所以...不过,还是要提醒一下:
1.效应量的SE具有误导性,因为它们没有考虑
sigma
的变化。1.这不是一个很好的例子,因为
a.因素相互作用(爱德华·洛的个人资料不同)。另请参阅警告信息。
B.模型是奇异的(如模型拟合时所警告的),
college
的估计方差为零)mec1mxoz2#