HH (version 1.5)

simint.mean: MMC (mean--mean multiple comparisons) plots from the sufficient statistics for a one-way design.

Description

Constructs a "mmc.multicomp" object from the sufficient statistics for a one-way design. The object must be explicitly plotted.

Usage

simint.mean(y, n, ybar, s, alpha=.05,  ## R
            ylabel="ylabel", focus.name="focus.factor", plot=FALSE,
            lmat, labels=NULL,
            method="Tukey",
            bounds="both",
            df=sum(n) - length(n),
            sigmahat=(sum((n-1)*s^2) / df)^.5,
            contrasts, ..., group=y)

simint.mmc.mean(y, n, ybar, s, alpha=.05, ## R ylabel="ylabel", focus.name="focus.factor", plot=FALSE, lmat, labels=NULL, method="Tukey", bounds="both", df=sum(n) - length(n), sigmahat=(sum((n-1)*s^2) / df)^.5, estimate.sign=1, order.contrasts=TRUE, ..., group=y)

multicomp.mean(group, n, ybar, s, alpha=.05, ## S-Plus ylabel="ylabel", focus.name="focus.factor", plot=FALSE, lmat, labels=NULL, ..., df=sum(n) - length(n), sigmahat=(sum((n-1)*s^2) / df)^.5)

multicomp.mmc.mean(group, n, ybar, s, ylabel, focus.name, ## S-Plus lmat, ..., comparisons="mca", lmat.rows=seq(length=length(ybar)), ry, plot=TRUE, crit.point, iso.name=TRUE, estimate.sign=1, x.offset=0, order.contrasts=TRUE, method="tukey", df=sum(n)-length(n), sigmahat=(sum((n-1)*s^2)/df)^.5)

Arguments

group, y
character vector of levels
n
numeric vector of sample sizes
ybar
vector of group means
s
vector of group standard deviations
alpha
Significance levels of test
ylabel
name of response variable
focus.name
name of factor
plot
logical. Should the "mmc.multicomp" object be automatically plotted? ignored in R.
lmat
lmat from multicomp in S-Plus or t(cmatrix) from simint in R.
labels
labels argument for multicomp in S-Plus. Not used in R.
method
method for critical point calculation. This corresponds to method in S-Plus multicomp and to type in R simint
bounds
type of intervals to compute. This is the "bounds" argument to multicomp and the alternative argument to simint. Values are: the default "both" for two-sided intervals; "
df
scalar, residual degrees of freedom
sigmahat
sqrt(MSE) from the ANOVA table
contrasts
logical, argument in R to contr.Dunnett when method="Dunnett".
...
other arguments
comparisons
argument to S-Plus multicomp only.
estimate.sign, order.contrasts, lmat.rows
See lmat.rows in multicomp.mmc or simint.mmc.
ry
See argument ry.mmc in plot.mmc.multicomp.
crit.point
See argument crit.point in S-Plus multicomp. The equivalent is not in simint.
iso.name, x.offset

Value

  • simint.mmc.mean and multicomp.mmc.mean return a "mmc.multicomp" object.

    simint.mean returns a "hmtest" object. multicomp.mean returns a "multicomp" object.

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.

Hsu, J. and Peruggia, M. (1994). "Graphical representations of {Tukey's} multiple comparison method." Journal of Computational and Graphical Statistics, 3:143--161.

See Also

simint.mmc, multicomp.mmc

Examples

Run this code
## This example is from Hsu and Peruggia

pulmonary <- read.table(hh("datasets/pulmonary.dat"), header=TRUE,
                        row.names="group")
pulmonary

anova.mean(row.names(pulmonary),
           pulmonary$n,
           pulmonary$ybar,
           pulmonary$s,
           ylabel="pulmonary")


## simint or multicomp object
pulmonary.mca <-
if.R(r=
simint.mean(row.names(pulmonary),
            pulmonary$n,
            pulmonary$ybar,
            pulmonary$s,
            ylabel="pulmonary",
            focus="smoker")
,s=
multicomp.mean(row.names(pulmonary),
               pulmonary$n,
               pulmonary$ybar,
               pulmonary$s,
               ylabel="pulmonary",
               focus="smoker")
)

pulmonary.mca
## lexicographic ordering of contrasts, some positive and some negative
plot(pulmonary.mca)



pulm.lmat <- cbind("npnl-mh"=c( 1, 1, 1, 1,-2,-2), ## not.much vs lots
                   "n-pnl"  =c( 3,-1,-1,-1, 0, 0), ## none vs light 
                   "p-nl"   =c( 0, 2,-1,-1, 0, 0), ## {} arbitrary 2 df
                   "n-l"    =c( 0, 0, 1,-1, 0, 0), ## {} for 3 types of light
                   "m-h"    =c( 0, 0, 0, 0, 1,-1)) ## moderate vs heavy
dimnames(pulm.lmat)[[1]] <- row.names(pulmonary)
pulm.lmat


## mmc.multicomp object
pulmonary.mmc <-
if.R(r=
simint.mmc.mean(row.names(pulmonary),
                pulmonary$n,
                pulmonary$ybar,
                pulmonary$s,
                ylabel="pulmonary",
                focus="smoker",
                lmat=pulm.lmat)
,s=
multicomp.mmc.mean(row.names(pulmonary),
                   pulmonary$n,
                   pulmonary$ybar,
                   pulmonary$s,
                   ylabel="pulmonary",
                   focus="smoker",
                   lmat=pulm.lmat,
                   plot=FALSE)
)


gray <- if.R(r="gray", s=16)
red  <- if.R(r="red",  s=8)
blue <- if.R(r="blue", s=6)

old.par <- if.R(s=par(mar=c(5,4,4,4)+.1),
                r=par(mar=c(15,4,4,4)+.1))

## pairwise comparisons
plot(pulmonary.mmc, print.mca=TRUE, print.lmat=FALSE,
     col.mca.signif=red, col.iso=16)

## tiebreaker plot, with contrasts ordered to match MMC plot,
## with all contrasts forced positive, and with names also reversed.
if.R(r={
pulmonary.xlim <- par()$usr[1:2]
plot(pulmonary.mmc$mca, xlim=pulmonary.xlim, xaxs="i", main="", xlab="")
},s={
plot(pulmonary.mmc$mca, col.signif=red, lty.signif=1, xlabel.print=FALSE,
     xaxs="d",  plt=par()$plt+c(0,0,-.25,.05), xrange.include=c(-1, 1.2))
})

## orthogonal contrasts
plot(pulmonary.mmc, print.lmat=TRUE, col.lmat.signif=blue, col.iso=16)

## pairwise and orthogonal contrasts on the same plot
plot(pulmonary.mmc, print.mca=TRUE, print.lmat=TRUE,
     col.mca.signif=red, col.lmat.signif=blue, col.iso=16,
     lty.lmat.not.signif=2)

par(old.par)

Run the code above in your browser using DataLab