cld {lsmeans}R Documentation

Compact letter display of pairwise comparisons

Description

Extract and display information on all pairwise comparisons of least-squares means.

Usage

## S3 method for class 'ref.grid'
cld(object, details = FALSE, sort = TRUE, by, alpha = 0.05, 
    Letters = c("1234567890", LETTERS, letters), ...)
## S3 method for class 'lsm.list'
cld(object, ..., which = 1)    

Arguments

object

An object of class ref.grid

details

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

sort

Logical value determining whether the LS means are sorted before the comparisons are produced

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, and a by variable was used in creating object, it is used as the by variable in cld.

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

...

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

which

When object is a list, this determines which element is analyzed.

Details

This function uses the Piepho (2004) algorithm (as implemented in the multcompView package) to generate a compact letter display of all pairwise comparisons of least-squares 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.

Value

When details == FALSE, an object of class summary.ref.grid (which inherits from data.frame) showing the summary of LS means with an added column named .groups with the cld information. When details == TRUE, a list the object just described, as well as the summary of the contrast results showing each comparison, its estimate, standard error, t ratio, and adjusted P value.

Note

This function requires the multcompView package to be installed. Otherwise an error message is produced.

Author(s)

Russell V. Lenth

References

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

See Also

cld in the multcomp package

Examples

warp.lm <- lm(breaks ~ wool * tension, data = warpbreaks)
warp.lsm <- lsmeans(warp.lm, ~ tension | wool)
cld(warp.lsm)                  # implicitly uses by = "wool"
cld(warp.lsm, by = "tension")  # overrides implicit 'by'

# Mimic grouping bars and compare all 6 means
cld(warp.lsm, by = NULL, Letters = "||||||||", alpha = .01)

[Package lsmeans version 2.23 Index]