I'm trying to perform a pairwise comparison after a glm
with a binomial dv, and emmeans
reports odds ratios, whereas I require a difference in probabilities.
library(magrittr)
library(emmeans)
glm(
am ~ wt * factor(vs),
family = binomial(),
data = mtcars
) %>%
emmeans(
~ vs | wt, at = list(wt = seq(2.6, 3.6, length.out = 10))
) %>%
pairs(type = "response")
returns
wt = 2.6:
contrast odds.ratio SE df z.ratio p.value
0 / 1 668.84887 3388.29452 Inf 1.284 0.1991
wt = 2.71111111111111:
contrast odds.ratio SE df z.ratio p.value
0 / 1 453.70452 2028.70137 Inf 1.368 0.1713
Add %>% regrid()
before pairs()
. The regrid()
call back-transforms all the results to a new set of EMMs as if there had never been a transformation.
See the vignette on transformations.