Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

CLD.emmGrid

Compact letter displays


Description

A method for multicomp::cld() is provided for users desiring to produce compact-letter displays (CLDs). This method uses the Piepho (2004) algorithm (as implemented in the multcompView package) to generate a compact letter display of all pairwise comparisons of estimated marginal means. The function obtains (possibly adjusted) P values for all pairwise comparisons of means, using the contrast function with method = "pairwise". When a P value exceeds alpha, then the two means have at least one letter in common.

Usage

## S3 method for class 'emmGrid'
cld(object, details = FALSE, sort = TRUE, by,
  alpha = 0.05, Letters = c("1234567890", LETTERS, letters),
  reversed = FALSE, ...)

Arguments

object

An object of class emmGrid

details

Logical value determining whether detailed information on tests of pairwise comparisons is displayed

sort

Logical value determining whether the EMMs are sorted before the comparisons are produced. When TRUE, the results are displayed according to reversed.

by

Character value giving the name or names of variables by which separate families of comparisons are tested. If NULL, all means are compared. If missing, the object's by.vars setting, if any, is used.

alpha

Numeric value giving the significance level for the comparisons

Letters

Character vector of letters to use in the display. Any strings of length greater than 1 are expanded into individual characters

reversed

Logical value (passed to multcompView::multcompLetters.) If TRUE, the order of use of the letters is reversed. In addition, if both sort and reversed are TRUE, the sort order of results is reversed.

...

Arguments passed to contrast (for example, an adjust method)

Note

We warn that such displays encourage a poor practice in interpreting significance tests. CLDs are misleading because they visually group means with comparisons P > alpha as though they are equal, when in fact we have only failed to prove that they differ. As alternatives, consider pwpp (graphical display of P values) or pwpm (matrix display).

References

Piepho, Hans-Peter (2004) An algorithm for a letter-based representation of all pairwise comparisons, Journal of Computational and Graphical Statistics, 13(2), 456-466.

Examples

if(requireNamespace("multcomp")) {
    pigs.lm <- lm(log(conc) ~ source + factor(percent), data = pigs)
    pigs.emm <- emmeans(pigs.lm, "percent", type = "response")
    multcomp::cld(pigs.emm, alpha = 0.10, Letters = LETTERS)
}

emmeans

Estimated Marginal Means, aka Least-Squares Means

v1.6.0
GPL-2 | GPL-3
Authors
Russell V. Lenth [aut, cre, cph], Paul Buerkner [ctb], Maxime Herve [ctb], Jonathon Love [ctb], Hannes Riebl [ctb], Henrik Singmann [ctb]
Initial release
2021-04-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.