I ran a multilevel binary logistic regression / generalized linear mixed-effects model in R, and then ran the following code to get post-hoc tests for a significant A x B interaction where A is a binary variable and B has 4 categories.
emms <- emmeans(model, ~ A | B)
con <- contrast(emms, interaction = "pairwise")
pairs(con, by = NULL)
I got the following output:
contrast estimate SE df z.ratio p.value
0 - 1,X - 0 - 1,Y 1.2841638 0.4307531 Inf 2.981 0.0152
0 - 1,X - 0 - 1,Z 0.7205958 0.4547173 Inf 1.585 0.3873
0 - 1,X - 0 - 1,Q 0.6951286 0.4497946 Inf 1.545 0.4103
0 - 1,Y - 0 - 1,Z -0.5635680 0.3647502 Inf -1.545 0.4105
0 - 1,Y - 0 - 1,Q -0.5890352 0.3605842 Inf -1.634 0.3597
0 - 1,Z - 0 - 1,Q -0.0254672 0.3908556 Inf -0.065 0.9999
I tried to get confidence intervals for the X v Y estimate (1.2841638
) but failed.
Is it okay to do it this way?
lower_bound <- exp(1.2841638 - (1.96*0.4307531))
upper_bound <- exp(1.2841638 + (1.96*0.4307531))
Is it okay to report this? I'm reporting the confint()
results for most other parameters (terms that come out of the model, and not out of emmeans post-hoc stuff) and I know that looks at slightly different confidence intervals, but I'm not sure how to get those a) manually or b) with a function out of this emmeans object.
con
step and dopairs(emm)
directly. 2. Addtype = “response”)
to theemmeans
call and the results will be back-transformed. OK, also 3. Look at the vignettes that come with emmeans for suggestions and examples. $\endgroup$(8*7)/2=28
comparisons while what I'm interested in is how the difference between the two levels of A differs between groups (6 comparisons, like above). (Similarly to what was going on here, but with a less complex interaction: stats.stackexchange.com/questions/355611/…) $\endgroup$emms
hasB
as aby
variable. If you don’t mess with it,pairs(emms)
will produce separate comparisons ofA
at eachB
$\endgroup$