问题
I'm following this tutorial as well as ?eff_size
from package emmeans
to compute eff_size()
for my regression model below.
But I get the error: need an object with call component
from the eff_size()
call. Am I missing something?
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`
回答1:
Are you tying for this? The object called should be a vector.
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))
Output:
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
来源:https://stackoverflow.com/questions/61903460/package-emmeans-in-r-not-returning-effect-sizes