mvcontrast | R Documentation |
This function displays tests of multivariate comparisons or contrasts.
The contrasts are constructed at each level of the variable in mult.name
,
and then we do a multivariate test that the vector of estimates is equal to
null
(zero by default). The F statistic and degrees
of freedom are determined via the Hotelling distribution. that is, if there are
m
error degrees of freedom and multivariate dimensionality d
, then
the resulting F
statistic has degrees of freedom (d, m - d + 1)
as shown in Hotelling (1931).
mvcontrast(object, method = "eff", mult.name = object@roles$multresp,
null = 0, by = object@misc$by.vars, adjust = c("sidak",
p.adjust.methods), show.ests = FALSE, ...)
object |
An object of class |
method |
A contrast method, per |
mult.name |
Character vector of names of the factors whose levels
define the multivariate means to contrast. If the model itself has a
multivariate response, that is what is used. Otherwise, |
null |
Scalar or conformable vector of null-hypothesis values to test against |
by |
Any |
adjust |
Character value of a multiplicity adjustment method
( |
show.ests |
Logical flag determining whether the multivariate means are displayed |
... |
Additional arguments passed to |
An object of class summary_emm
containing the multivariate
test results; or a list of the estimates and the tests if show.ests
is TRUE
. The test results include the Hotelling T^2
statistic,
F
ratios, degrees of freedom, and P
values.
If some interactions among the primary and mult.name
factors are
absent, the covariance of the multivariate means is singular; this situation
is accommodated, but the result has reduced degrees of freedom and a message
is displayed. If there are other abnormal conditions such as non-estimable
results, estimates are shown as NA
.
While designed primarily for testing contrasts, multivariate tests of the
mean vector itself can be implemented via method = "identity")
(see
the examples).
Hotelling, Harold (1931) "The generalization of Student's ratio", Annals of Mathematical Statistics 2(3), 360–378. doi:10.1214/aoms/1177732979
MOats.lm <- lm(yield ~ Variety + Block, data = MOats)
MOats.emm <- emmeans(MOats.lm, ~ Variety | rep.meas)
mvcontrast(MOats.emm, "consec", show.ests = TRUE) # mult.name defaults to rep.meas
# Test each mean against a specified null vector
mvcontrast(MOats.emm, "identity", name = "Variety",
null = c(80, 100, 120, 140), adjust = "none")
# (Note 'name' is passed to contrast() and overrides default name "contrast")
# 'mult.name' need not refer to a multivariate response
mvcontrast(MOats.emm, "trt.vs.ctrl1", mult.name = "Variety")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.