R: Support for 'multcomp::glht'

emm {emmeans} | R Documentation

## Support for `multcomp::glht`

### Description

These functions and methods provide an interface between emmeans and the `glht` function for simultaneous inference provided by the multcomp package.

### Usage

    emm(...)

    as.glht(object, ...)

    ## S3 method for class 'emmGrid'
    as.glht(object, ...)

### Arguments

`...` | In `emm`, the `specs`, `by`, and `contr` arguments you would normally supply to `emmeans`. Only `specs` is required. Otherwise, arguments that are passed to other methods.
`object` | An object of class `emmGrid` or `emm_list`

### Details

`emm` 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 `emmeans`.

### Value

`emm` returns an object of an intermediate class for which there is a `glht` method.

`as.glht` returns an object of class `glht` or `glht_list` according to whether `object` is of class `emmGrid` or `emm_list`. See Details below for more on `glht_list`s.

### Details

A `glht_list` object is simply a `list` of `glht` objects. It is created as needed – for example, when there is a `by` variable. Appropriate convenience methods `coef`, `confint`, `plot`, `summary`, and `vcov` are provided, which simply apply the corresponding `glht` methods to each member.

### Note

The multivariate-t routines used by `glht` require that all estimates in the family have the same integer degrees of freedom. In cases where that is not true, a message is displayed that shows what df is used. The user may override this via the `df` argument.

### Examples

    require(multcomp)

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

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

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

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

[Package emmeans version 1.1.3 Index]