Support for multcomp::glht
These functions and methods provide an interface between emmeans and
the multcomp::glht
function for simultaneous inference provided
by the multcomp package.
emm(...) as.glht(object, ...) ## S3 method for class 'emmGrid' as.glht(object, ...)
... |
In |
object |
An object of class |
emm
is meant to be called only from "glht"
as its second
(linfct
) argument. It works similarly to multcomp::mcp
,
except with specs
(and optionally by
and contr
arguments) provided as in a call to emmeans
.
emm
returns an object of an intermediate class for which
there is a multcomp::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.
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.
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.
if(require(multcomp)) { # --- multcomp must be installed 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)) } # --- was tested only if multcomp is installed
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.