包 emmeans in 不返回效果大小



我正在按照本教程以及包emmeans中的?eff_size来计算下面回归模型的eff_size()

但是我收到错误:need an object with call component来自eff_size()呼叫。我错过了什么吗?

library(lme4)
library(emmeans)
h <- read.csv('https://raw.githubusercontent.com/hkil/m/master/h.csv')
h$year <- as.factor(h$year)
m <- lmer(scale~year*group + (1|stid), data = h)
ems <- emmeans(m, pairwise ~ group*year, infer = c(T, T))
eff_size(ems, sigma = sigma(m), edf = df.residual(m))
# `Error: need an object with call component`

你是在为此而捆绑吗?调用的对象应该是向量。

m <- lmer(scale~year*group + (1|stid), data = h)
ems <- emmeans(m, c("group","year"), infer = c(T, T))
eff_size(ems, sigma = sigma(m), edf = df.residual(m))

输出:

contrast  effect.size    SE  df lower.CL upper.CL
C,0 - T,0      0.7289 0.224 507    0.289    1.169
C,0 - C,1     -2.0011 0.134 507   -2.263   -1.739
C,0 - T,1     -1.2370 0.229 507   -1.687   -0.787
C,0 - C,2     -3.1640 0.161 507   -3.481   -2.847
C,0 - T,2     -3.1173 0.261 507   -3.630   -2.605
T,0 - C,1     -2.7300 0.239 536   -3.199   -2.261
T,0 - T,1     -1.9659 0.159 536   -2.279   -1.653
T,0 - C,2     -3.8929 0.257 536   -4.397   -3.388
T,0 - T,2     -3.8462 0.218 536   -4.275   -3.417
C,1 - T,1      0.7642 0.232 558    0.308    1.220
C,1 - C,2     -1.1628 0.139 558   -1.436   -0.889
C,1 - T,2     -1.1162 0.253 558   -1.614   -0.619
T,1 - C,2     -1.9270 0.244 572   -2.406   -1.448
T,1 - T,2     -1.8803 0.193 572   -2.259   -1.502
C,2 - T,2      0.0467 0.258 634   -0.460    0.554
sigma used for effect sizes: 63.67 
Degrees-of-freedom method: inherited from kenward-roger when re-gridding 
Confidence level used: 0.95

相关内容

  • 没有找到相关文章

最新更新