Last chance! 50% off unlimited learning
Sale ends in
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 emmGrid
as.glht(object, ...)
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.
An object of class emmGrid
or emm_list
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.
# NOT RUN {
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
# }
Run the code above in your browser using DataLab