# How to perform post-hoc tests with the package emmeans [closed]

After running a generalised linear mixed effect model I have estimated the logit probability by using "emtrends" from emmeans package. The variable Condition is a factor with 3 levels(old,lure,new), The variable Age is a factor with 2 levels (0,1) and ZcMeans is a covariate.

emt1 <- emtrends(model_glmer_older, ~ Condition | Age, var = "ZcMeanS")


These are the estimated marginal means:

Age = 0:
Condition ZcMeanS.trend         SE  df   asymp.LCL  asymp.UCL
new          0.31176866 0.09498094 Inf  0.12560944 0.49792789
lure         0.01389462 0.07484836 Inf -0.13280547 0.16059472
old         -0.15495166 0.09029811 Inf -0.33193270 0.02202938

Age = 1:
Condition ZcMeanS.trend         SE  df   asymp.LCL  asymp.UCL
new          0.23472150 0.10188721 Inf  0.03502624 0.43441677
lure         0.02707337 0.07488078 Inf -0.11969026 0.17383700
old         -0.15680374 0.09058336 Inf -0.33434387 0.02073639


I then ran the contrasts:

pairs(emt1, reverse = TRUE)


and the results is:

Age = 0:
contrast     estimate         SE  df z.ratio p.value
lure - new -0.2978740 0.09017972 Inf  -3.303  0.0028
old - new  -0.4667203 0.10400818 Inf  -4.487  <.0001
old - lure -0.1688463 0.08606666 Inf  -1.962  0.1218

Age = 1:
contrast     estimate         SE  df z.ratio p.value
lure - new -0.2076481 0.09731282 Inf  -2.134  0.0831
old - new  -0.3915252 0.11042750 Inf  -3.546  0.0011
old - lure -0.1838771 0.08630724 Inf  -2.130  0.0838


What I need to do now is to perform a further post-hoc test, but this time between the age groups. For instance, I would like to compare the estimates I have in Age 1 for lure - new (i.e., -2076481) with the one that I have in Age 0 for lure - new (i.e., -2978740) to see if they are significantly different or not. How could I create these contrasts by using the same package?

## closed as off-topic by ttnphns, Michael Chernick, mdewey, Peter Flom♦Jul 28 '18 at 14:19

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – ttnphns, Michael Chernick, mdewey, Peter Flom
If this question can be reworded to fit the rules in the help center, please edit the question.

• Why has my question been put on hold? How may I edit it? – Lollo Jul 28 '18 at 15:54
• Isn’t there a link explaining the off-topic notice? There is for me. But a quick answer anyway: Do con <- pairs(emt1, reverse = TRUE) and then pairs(con, by = “contrast”, reverse = TRUE). In other words, the results from these emmeans functions are candidates for further processing with the same functions. – rvl Jul 29 '18 at 1:08