# 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`"hmtest"`

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, accepted).
"Mean--mean multiple comparison displays for families of linear contrasts."
*Journal of Computational and Graphical Statistics*.

##### See Also

`MMC`

, `as.hmtest in R`

,
`simint.reverse`

in R, `multicomp.reverse`

in S-Plus

##### Examples

```
## continue with the example in simint.mmc in R, or multicomp.mmc in S-Plus
catalystm <- read.table(hh("datasets/catalystm.dat"), header=FALSE,
col.names=c("catalyst","concent"))
catalystm$catalyst <- factor(catalystm$catalyst, labels=c("A","B","C","D"))
catalystm1.aov <- aov(concent ~ catalyst, data=catalystm)
if.R(r={
catalystm.mca <-
simint(concent ~ catalyst, data=catalystm, type="Tukey")
catalystm.mca
catalystm.mmc <-
simint.mmc(concent ~ catalyst, data=catalystm, type="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.
as.hmtest(catalystm.mmc$mca)
## now simplify the contrast names by removing the string "catalyst"
tmp <- multicomp.label.change(catalystm.mmc$mca, "catalyst", "")
as.hmtest(tmp)
## for consistency with the S-Plus example, we change all factor level
## "A" to "control".
as.hmtest(multicomp.label.change(tmp, "A", "control"))
},s={
## continue with the example in simint.mmc in R, or mmc in S-Plus
catalystm1.aov <- aov(concent ~ catalyst, data=catalystm)
catalystm.mca <-
multicomp(catalystm1.aov, method="Tukey")
catalystm.mca
catalystm.mmc <-
multicomp.mmc(catalystm1.aov, method="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.
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".
multicomp.label.change(catalystm.mmc$mca, "A", "control")
})
```

*Documentation reproduced from package HH, version 1.8, License: GPL version 2 or newer*