# multicomp.order

##### Update a multicomp object by ordering its contrasts.

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.

- Keywords
- dplot

##### Usage

`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)

##### Arguments

- mca
`"multicomp"`

object. This is the result of`multicomp`

in S-Plus or the result from applying`as.multicomp`

to a`"glht"`

object in R.- sort.by
- Either
`"height"`

or`"estimate"`

. - sort.order
- Vector of indices by which the contrasts are to be
sorted. When
`sort.order`

in non-`NULL`

, it is used. - x
`"multicomp"`

object.- 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.

##### Value

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

##### Note

S-Plus use the `multicomp`

functions
and R uses the `multcomp`

package.

##### References

Heiberger, Richard M. and Holland, Burt (2004b).
*Statistical Analysis and Data Display: An Intermediate Course
with Examples in S-Plus, R, and SAS*.
Springer Texts in Statistics. Springer.
ISBN 0-387-40270-5.

Heiberger, R.~M. and Holland, B. (2006).
"Mean--mean multiple comparison displays for families of linear contrasts."
*Journal of Computational and Graphical Statistics*, 15:937--955.

##### See Also

`MMC`

, `as.glht in R`

,
`multicomp.reverse`

##### Examples

```
## 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"))
})
```

*Documentation reproduced from package HH, version 2.3-42, License: GPL (>= 2)*