1
library(lme4)
library(emmeans)
m <- lmer(angle ~ recipe*temp + (1|replicate), data=cake)

I'm interested in the simple effect of each recipe (not pairwise comparisons) so based on this post

out.emtrends <- emtrends(m, pairwise~recipe, var="temp")
emtr <- as.data.frame(out.emtrends$emtrends)
tvalues <- emtr$temp.trend/emtr$SE
dfs <- emtr$df
pvalues <- 2*pt(-abs(tvalues), dfs)

Now I would like to use Tukey's test for correcting my p-value; is this possible or is Tukey's test only appropriate for differences between treatments?

locus
  • 387
  • 2
  • 9
  • 1
    This doesn't appear to be a specific programming question that's appropriate for Stack Overflow. If you have general questions about the appropriate use of various statistical methods, then you should ask such questions over at [stats.se] instead. You are more likely to get better answers there. – MrFlick Aug 27 '19 at 19:52
  • `summary(out.emtrends, infer=rep(TRUE,2))$p.value` will give you unadjusted p-values. You're right that Tukey is for pairwise comparisons, not for multiple-comparisons corrections on a set of values. Check out `?p.adjust` for other options (Bonferroni, Bonferroni-Holm, etc etc) – Ben Bolker Aug 27 '19 at 20:31
  • I don’t quite agree with @BenBolker ‘s answer. See the answer I posted. To get unadjusted tests, use ‘adjust = “none”‘ – Russ Lenth Aug 27 '19 at 20:54
  • I'm trying to interpret what the OP said, which is "I'm interested in the trend for each recipe", i.e. they're not actually trying to get pairwise comparisons. (I started out writing a comment that's a lot like your answer, then I thought that's not what they actually wanted ...) – Ben Bolker Aug 27 '19 at 21:02
  • I voted to close as "unclear". If you can explain more clearly whether you want pairwise tests or simply tests of each group individually, that would help. – Ben Bolker Aug 27 '19 at 21:03
  • @BenBolker, I'm trying to test the slopes of each recipe indeividually, so your code above does what I was looking for. And I suspected that Tukey might not be the test for this so I'll check out the other options then. Thanks! – locus Aug 27 '19 at 22:21
  • if two more people vote to reopen I'll post my answer. – Ben Bolker Aug 27 '19 at 23:06
  • @BenBolker have at it. – Roman Luštrik Aug 28 '19 at 06:31

1 Answers1

3

When using pairwise, the adjustment actually defaults to Turkey. You will see it in the annotations below the contrast results if you simply display it via

out.emtrends

However, there is one exception, and that is when there are only two estimates in the family being compared. In that case, there is only one comparison. In that case, there is no multiplicity and thus no need for any kind of adjustment for multiplicity.

Russ Lenth
  • 5,922
  • 2
  • 13
  • 21