R: 'lsmeans' support for 'glht'

glht {lsmeans} | R Documentation

## 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 'lsm.list'
    as.glht(object, ..., which = 1)

    ## S3 method for class 'glht.list'
    coef(object, ...)
    ## S3 method for class 'glht.list'
    confint(object, ...)
    ## S3 method for class 'glht.list'
    plot(x, ...)
    ## S3 method for class 'glht.list'
    summary(object, ...)
    ## S3 method for class 'glht.list'
    vcov(object, ...)

    lsm(...)
    pmm(...)

### Arguments

`object, x` | An object of the required class.
`which` | Numeric index of which element of the `lsm.list` to use.
`...` | Additional arguments to other methods.

### Details

`lsm` (and `pmm`, which is identical) are 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` or `pmmeans`.

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 appropriate methods `coef`, `confint`, `plot`, `summary`, and `vcov` are provided.

### 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, and the provided methods `coef`, `confint`, `plot`, `summary`, and `vcov` simply `lapply` the corresponding methods for class `"glht"`.

### Note

There is also a `glht` method for class `ref.grid`, but it is far preferable to use `as.glht` instead, as its `model` argument is redundant.

### Author(s)

Russell V. Lenth

### See Also

`lsmeans`, `glht`

### Examples

    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))

[Package lsmeans version 2.27-62 Index]