## 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")
})
Run the code above in your browser using DataCamp Workspace