Using adjust = "tukey"
means that critical values and adjusted P values are obtained from the Studentized range distribution qtukey()
and ptukey()
respectively. Those are the same critical values that are used in the Tukey HSD test. But to put a very fine edge on it, the Tukey HSD method is really defined only for independent samples of equal size, which may or may not be the case for emmeans()
results. For more details, see ? summary.emmGrid
and refer to the section on P-value adjustments.
Regarding the second question, both pairwise.emmc()
generates contrast coefficients for pairwise comparisons; as does revpairwise.emmc()
. Here is a third possibility:
> emmeans:::tukey.emmc
function(levs, reverse = FALSE, ...) {
if (reverse)
revpairwise.emmc(levs, ...)
else
pairwise.emmc(levs, ...)
}
That is, tukey.emmc()
invokes one of those pairwise-comparison methods depending on reverse
. Thus, contrast(..., method = "tukey", reverse = TRUE)
is equivalent to contrast(..., method = "revpairwise")
.
Every .emmc
function passes a default adjustment method to contrast()
, and in the case of pairwise.emmc()
and tukey.emmc()
, that default is adjust = "tukey"
. Thus, calling contrast(..., method = "pairwise")
is the same as contrast(..., method = "pairwise", adjust = "tukey")
. Whereas calling some other contrast function may produce different defaults. For example, consec.emmc()
passes the "mvt"
adjustment by default:
> emmeans:::consec.emmc(1:4)
2 - 1 3 - 2 4 - 3
1 -1 0 0
2 1 -1 0
3 0 1 -1
4 0 0 1
> attributes(.Last.value)
$names
[1] "2 - 1" "3 - 2" "4 - 3"
$row.names
[1] 1 2 3 4
$class
[1] "data.frame"
$desc
[1] "changes between consecutive levels"
$adjust
[1] "mvt"
An additional comment about the Tukey adjustment: That adjustment is only appropriate for a single set of pairwise comparisons. If you specify adjust = "tukey"
for non-pairwise comparisons or arbitrary contrasts, it will overrule you and use the "sidak"
adjustment instead.