## 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 in S-Plus for all designs
### $none works in R 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)
Run the code above in your browser using DataLab