simint.mmc {HH} | R Documentation |
Constructs a "mmc.multicomp"
object from the formula and
other arguments. The object must be explicitly plotted.
simint.mmc(y, ## R data, type = "Tukey", lmat=NULL, lmat.rows=2:nrow(mca.lmat), lmat.scale.abs2=TRUE, estimate.sign=1, order.contrasts=TRUE, whichf, cmatrix=t(lmat), covariates, ...) multicomp.mmc(..., comparisons="mca", ##S-Plus lmat, lmat.rows=-1, lmat.scale.abs2=TRUE, ry, plot=TRUE, crit.point, iso.name=TRUE, estimate.sign=1, x.offset=0, order.contrasts=TRUE, main, main2) "[.mmc.multicomp"(x, ..., drop = TRUE)
y |
Analysis of variance formula. |
data |
data.frame |
type |
type of contrasts. See simint for
the list. |
lmat |
contrast matrix as in the S-Plus multicomp .
The convention for lmat in R is to use
the transpose of the cmatrix component produced by
simint . Required for user-specified contrasts. |
lmat.rows |
rows in lmat for the whichf factor. |
whichf |
define the factor to compute contrasts of.
See simint . This argument is called
focus in multicomp . |
cmatrix |
transpose of the "lmat" argument. |
covariates |
The current version of multcomp (0.4-8
in R-2.3.1) doesn't handle covariates correctly. |
... |
other arguments. alternative and
base are frequently used with simint . |
comparisons |
argument to multicomp |
lmat.scale.abs2 |
logical, scale the contrasts in the columns of
lmat to make the sum of the absolute values of each column equal 2. |
estimate.sign |
numeric. If 0 , leave contrasts in the
default lexicographic direction. If positive, force all contrasts to positive,
reversing their names if needed (if contrast A-B is negative, reverse it
to B-A). If negative, the force all contrasts to positive. |
order.contrasts |
sort the contrasts in the (mca , none ,
lmat ) components by height on the MMC plot. This will place the
contrasts in the multicomp plots in the same order as in the MMC plot. |
crit.point |
critical value for the tests. The value from the
specified multicomp method is used for the user-specified
contrasts when lmat is specified. This argument is not
available with simint in R. |
plot |
logical, display the plot if TRUE . |
ry, iso.name, x.offset, main, main2 |
arguments to
plot.mmc.multicomp . |
x, drop |
See "[" . |
By default we plot the isomeans grid and the pairwise comparisons. We get the right contrasts automatically if the aov is oneway. If we specify an lmat for oneway it must have a leading row of 0.
For any more complex design, we must study the lmat from the mca component of the result to see how to construct the lmat (with the extra rows as needed) and how to specify the lmat.rows corresponding to the rows for the focus factor.
simint
in R multcomp
version 0.4-8 doesn't work correctly
with covariates.
simint.mmc
works from a formula, not from an "aov"
object as
multicomp.mmc
in S-Plus does.
In R, an "mmc.multicomp"
object containing either the first
three, or all five, of the following components:
mca |
"multicomp" object containing the pairwise comparisons. |
none |
"multicomp" object comparing each mean to 0. |
hmtest |
"hmtest" object from simint for the
pairwise comparisons. |
lmat |
"multicomp" object for the contrasts specified in
the lmat argument. |
lmat.hmtest |
"hmtest" object from simint for the
contrasts specified in the lmat argument. |
mca |
|
none |
|
lmat |
) as described above.
"[.mmc.multicomp"
is a subscript method.
The multiple comparisons calculations in R and S-Plus use
completely different functions.
MMC plots in R are constructed by simint.mmc
based on simint
.
MMC plots in S-Plus are constructed by
multicomp.mmc
based on the S-Plus multicomp
.
The MMC plot is the same in both systems. The details of getting the
plot differ.
Richard M. Heiberger <rmh@temple.edu>
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.
Hsu, J. and Peruggia, M. (1994). "Graphical representations of {Tukey's} multiple comparison method." Journal of Computational and Graphical Statistics, 3:143–161.
## simint is strictly for R. Use multicomp.mmc with S-Plus. ## data and ANOVA 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")) if.R(r= bwplot(concent ~ catalyst, data=catalystm, scales=list(cex=1.5), ylab=list("concentration", cex=1.5), xlab=list("catalyst",cex=1.5)) ,s= t(bwplot(catalyst ~ concent, data=catalystm, scales=list(cex=1.5), xlab=list("concentration", cex=1.5), ylab=list("catalyst",cex=1.5))) ) catalystm1.aov <- aov(concent ~ catalyst, data=catalystm) catalystm.mca <- if.R(r=simint(concent ~ catalyst, data=catalystm, type="Tukey"), s=multicomp(catalystm1.aov, plot=F)) plot(catalystm.mca) catalystm.mca ## pairwise comparisons catalystm.mmc <- if.R(r=simint.mmc(concent ~ catalyst, data=catalystm), s=multicomp.mmc(catalystm1.aov, plot=F)) if.R(r=catalystm.mmc <- multicomp.label.change(catalystm.mmc, "catalyst", ""), s={}) catalystm.mmc plot(catalystm.mmc) if.R(r=plot(catalystm.mmc, col.mca.signif="red"), s={}) plot(catalystm.mmc$mca) plot(catalystm.mmc$none) ### $none works for oneway ANOVA, not sure yet beyond that ## user-specified contrasts catalystm.lmat <- cbind("AB-D" =c(0, 1, 1, 0,-2), "A-B" =c(0, 1,-1, 0, 0), "ABD-C"=c(0, 1, 1,-3, 1)) dimnames(catalystm.lmat)[[1]] <- dimnames(catalystm.mmc$mca$lmat)[[1]] zapsmall(catalystm.lmat) if.R(s=dimnames(catalystm.mca$lmat)[[1]], r=c("(Intercept)", dimnames(catalystm.mca$cmatrix)[[2]][-1])) if.R(r={ catalystm.mmc <- simint.mmc(concent ~ catalyst, data=catalystm, lmat=catalystm.lmat, lmat.rows=2:5, type="Tukey", whichf="catalyst") catalystm.mmc <- multicomp.label.change(catalystm.mmc, "catalyst", "") }, s={ catalystm.mmc <- multicomp.mmc(catalystm1.aov, lmat=catalystm.lmat, plot=FALSE) }) catalystm.mmc plot(catalystm.mmc) if.R(r=plot(catalystm.mmc, col.lmat.signif="red"), s={}) plot(catalystm.mmc$mca) plot(catalystm.mmc$none) plot(catalystm.mmc$lmat) ## Dunnett's test weightloss <- read.table(hh("datasets/weightloss.dat"), header=TRUE) weightloss <- data.frame(loss=unlist(weightloss), group=rep(names(weightloss), rep(10,5))) if.R(r= bwplot(loss ~ group, data=weightloss, scales=list(cex=1.5), ylab=list("Weight Loss", cex=1.5), xlab=list("group",cex=1.5)) ,s= t(bwplot(group ~ loss, data=weightloss, scales=list(cex=1.5), xlab=list("Weight Loss", cex=1.5), ylab=list("group",cex=1.5))) ) weightloss.aov <- aov(loss ~ group, data=weightloss) summary(weightloss.aov) tmp.dunnett <- if.R(r= simint(loss ~ group, data=weightloss, type="Dunnett", alternative="greater", base=4) ,s= multicomp(weightloss.aov, method="dunnett", comparisons="mcc", bounds="lower", control=4, valid.check=FALSE) ) plot(tmp.dunnett) if.R(r={ tmp.dunnett.mmc <- simint.mmc(loss ~ group, data=weightloss, type="Dunnett", alternative="greater", base=4) tmp.dunnett.mmc <- multicomp.label.change(tmp.dunnett.mmc, "group", "") },s= tmp.dunnett.mmc <- multicomp.mmc(weightloss.aov, method="dunnett", comparisons="mcc", bounds="lower", control=4, valid.check=FALSE, plot=FALSE) ) tmp.dunnett.mmc plot(tmp.dunnett.mmc)