View source: R/multicomp.order.R
multicomp.order | R Documentation |
Update a multicomp object by ordering its contrasts.
The default sort.by = "height"
matches the order in the MMC plot.
An alternate sort.by = "estimate"
matches the order of the
half-normal plot. Or the argument sort.order
can be used
to specify any other order.
multicomp.order(mca, sort.by = "height", sort.order = NULL)
multicomp.label.change(x, old="adj", new="new", how.many=2)
## S3 method for class 'multicomp'
multicomp.label.change(x, old="adj", new="new", how.many=2)
## S3 method for class 'mmc.multicomp'
multicomp.label.change(x, old="adj", new="new", how.many=2)
mca |
|
sort.by |
Either |
sort.order |
Vector of indices by which the contrasts are to be
sorted. When |
x |
|
old |
character string to be removed from contrast names. |
new |
replacement character string to be inserted in contrast names. |
how.many |
number of times to make the replacement. |
The result is a "multicomp"
object containing the same
contrasts as the argument.
multicomp.order
sorts the contrasts
(and renames them consistently) according to the specifications.
multicomp.label.change
changes the contrast names according to the specifications.
When sort.by=="height"
, sort the contrasts by the reverse order
of the heights. This provides a "multicomp"
object that will be
plotted by plot.multicomp
in the same order used by
mmcplot
or the older plot.mmc.multicomp
. If there is not "height"
component,
the original "multicomp"
object is returned.
When sort.by=="estimate"
, sort the contrasts by the reverse order
of the contrast estimates. This provides the same order as the
half-normal plot.
When sort.order
in non-NULL
, sort the contrasts in
that order.
S-Plus use the multicomp
functions
and R uses the multcomp
package.
Richard M. Heiberger <rmh@temple.edu>
Heiberger, Richard M. and Holland, Burt (2015). Statistical Analysis and Data Display: An Intermediate Course with Examples in R. Second Edition. Springer-Verlag, New York. https://link.springer.com/book/10.1007/978-1-4939-2122-5
Heiberger, Richard M. and Holland, Burt (2006). "Mean–mean multiple comparison displays for families of linear contrasts." Journal of Computational and Graphical Statistics, 15:937–955.
MMC
, as.glht in R
,
multicomp.reverse
## continue with the example in mmc in R, or multicomp.mmc in S-Plus
data(catalystm)
catalystm1.aov <- aov(concent ~ catalyst, data=catalystm)
if.R(r={
catalystm.mca <-
glht(catalystm1.aov, linfct = mcp(catalyst = "Tukey"))
print(confint(catalystm.mca))
catalystm.mmc <-
mmc(catalystm1.aov, linfct = mcp(catalyst = "Tukey"))
## the contrasts have been ordered by height (see ?MMC),
## which in this example corresponds to sort.order=c(1,2,4,3,5,6),
## and reversed, to make the contrast Estimates positive.
print(as.glht(catalystm.mmc$mca))
## ## For consistency with the S-Plus example,
## ## we change all factor level "A" to "control".
## as.glht(multicomp.label.change(catalystm.mmc$mca, "A", "control"))
},s={
catalystm.mca <-
multicomp(catalystm1.aov, method="Tukey")
print(catalystm.mca)
catalystm.mmc <-
multicomp.mmc(catalystm1.aov, method="Tukey", plot=FALSE)
## the contrasts have been ordered by height (see ?MMC),
## which in this example corresponds to sort.order=c(1,2,4,3,5,6),
## and reversed, to make the contrast Estimates positive.
print(catalystm.mmc$mca)
## S-Plus multicomp already uses simple names. This function is
## therefore used in more complex two-way ANOVA examples. We illustrate
## here by changing all factor level "A" to "control".
print(multicomp.label.change(catalystm.mmc$mca, "A", "control"))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.