Is there an equivalent to the del.eff
method in emmeans
?
#1091
Replies: 2 comments 4 replies
-
Hi @walrossker, Unfortunately, there currently there isn't an easy shortcut for this. I opened a issue for the feature request here: #1092 In that issue, you'll see that I included some code to replicate your There are a couple tricky challenges for implementation, but those can probably be overcome. |
Beta Was this translation helpful? Give feedback.
-
Also note that the only reason this is anything more than trivial is that you are using the library(emmeans)
library(marginaleffects)
dat <- transform(mtcars, cyl = factor(cyl))
mod <- lm(mpg ~ cyl, data = dat)
emm <- emmeans::emmeans(mod, "cyl")
emmeans::contrast(emm, method = "eff")
avg_predictions(mod, by = "cyl", transform = \(z) z - mean(z)) |
Beta Was this translation helpful? Give feedback.
-
Hi @vincentarelbundock, for a categorical predictor with 3+ levels, I'm hoping to compare each group's mean to the mean of everyone else in the sample that's not in the group. Below is an example of how this can be done in
emmeans
(i.e., weigh each group by its size since the default reference group is an average of the other group averages).Is there a way to accomplish this using the
marginaleffects
package? Similar question for theeff
method inemmeans
which compares each group to the overall sample mean.Beta Was this translation helpful? Give feedback.
All reactions