Learn R Programming

lsmeans (version 2.10)

glht: lsmeans support for glht

Description

These functions and methods provide an interface between lsmeans and the glht function for simultaneous inference in the multcomp package.

Usage

## S3 method for class 'ref.grid':
as.glht(object, ...)

## S3 method for class 'glht.list':
summary(object, ...)

lsm(...)

Arguments

object
An object of the required class.
...
Additional arguuments to other methods.

Value

  • as.glht returns an object of class glht, or of class glht.list if by is non-NULL. The latter is simply a list of glht objects but it has its own summary method which returns a list of summary.glht objects.

Details

lsm is meant to be called only from "glht" as its second (linfct) argument. It works similarly to mcp except with specs (and optionally by and contr arguments) provided as in a call to lsmeans. When there is a non-NULL by variable (either explicitly or implicitly), each ``by'' group is passed separately to glht and returned as a list of "glht" objects. For convenience, this is classed as "glht.list" and a summary method is provided.

See Also

lsmeans, glht

Examples

Run this code
require(lsmeans)
require(multcomp)

warp.lm <- lm(breaks ~ wool*tension, data = warpbreaks)

# Using 'lsm'
summary(glht(warp.lm, lsm(pairwise ~ tension | wool)))

# Same, but using an existing 'lsmeans' result
warp.lsmobj <- lsmeans(warp.lm, ~ tension | wool)
summary(as.glht(pairs(warp.lsmobj)))

# Same contrasts, but treat as one family
summary(as.glht(pairs(warp.lsmobj), by = NULL))

Run the code above in your browser using DataLab