# Pairwise contrasts for logistic regression in emmeans, back-transform or not?

I ran a mixed effects logistic regression in R (glmer). The model identified a significant three-way interaction that I am interested in decomposing using post-hoc multiple comparison in emmeans. In this case Treatment is a factor (2 factors), Temp is a factor (2 factors), and mismatch.num is a continuous variable. I want to identify how the slopes of treatment differ within a given temperature. Since this is a logistic model, I typically back-transform the results when doing contrasts (on a side note, when I use type="response", nothing changes in my results, so I use transform). My question is why are my pairwise contrasts so different depending on whether I back-transform or not? Which contrasts should I use? Based on the Anova table, the non back-transformed contrasts seem to match what I expect more than the back-transformed contrasts

emtrends(psit.tot8.4, pairwise ~ Treatment|Temp, var = "mismatch.num", adjust="Tukey", transform="response")


I get the following output:

$emtrends Temp = 24: Treatment mismatch.num.trend SE df asymp.LCL asymp.UCL C -0.0794 0.01498 Inf -0.1087 -0.04999 NC -0.0922 0.01605 Inf -0.1237 -0.06072 Temp = 28: Treatment mismatch.num.trend SE df asymp.LCL asymp.UCL C -0.0191 0.00507 Inf -0.0290 -0.00913 NC -0.0110 0.00285 Inf -0.0166 -0.00541 Results are averaged over the levels of: WaspSpecies, Species Confidence level used: 0.95$contrasts
Temp = 24:
contrast estimate      SE  df z.ratio p.value
C - NC    0.01283 0.01362 Inf  0.942  0.3461

Temp = 28:
contrast estimate      SE  df z.ratio p.value
C - NC   -0.00807 0.00425 Inf -1.898  0.0577

Results are averaged over the levels of: WaspSpecies, Species


Now if I run the exact same code, but omit the transform="response", these are my contrasts.

emtrends(psit.tot8.4, pairwise ~ Treatment|Temp, var = "mismatch.num", adjust="Tukey")


Here are the results:

$emtrends Temp = 24: Treatment mismatch.num.trend SE df asymp.LCL asymp.UCL C -0.724 0.0599 Inf -0.841 -0.606 NC -0.947 0.0619 Inf -1.069 -0.826 Temp = 28: Treatment mismatch.num.trend SE df asymp.LCL asymp.UCL C -0.838 0.1119 Inf -1.057 -0.618 NC -0.662 0.0834 Inf -0.825 -0.498 Results are averaged over the levels of: WaspSpecies, Species Confidence level used: 0.95$contrasts
Temp = 24:
contrast estimate     SE  df z.ratio p.value
C - NC      0.224 0.0858 Inf  2.606  0.0092

Temp = 28:
contrast estimate     SE  df z.ratio p.value
C - NC     -0.176 0.1394 Inf -1.261  0.2073

Results are averaged over the levels of: WaspSpecies, Species


Which result should I use for determining what is causing the three-way interaction? Why are the contrasts different? Is there something else wrong with what I am doing in my code? Thanks for the help. In case it is important, I am using emmeans version 1.4.3.01.

• I think you are far better off without back transforming. That way, you are comparing the slopes of the lines in the second plot, which are the same no matter what. You could use at = to specify different mismatch.sum values when back transforming, and the slopes would compare differently at each value. – Russ Lenth Jul 9 '20 at 20:23
• That is what I figured. Thanks for the response. I have also looked at slopes at each mismatch value for the back transformed responses because it is an important part of my hypothesis. I am glad that it is nothing wrong with my code. Cheers – Nick Pardikes Jul 10 '20 at 7:58