Dear all,
I was trying to understand how "multcomp" package works by running the
examples given in the documentation.
However I still don't understand when it comes to multiple comparison set by
user (please refer to "Ksub" in the code). Therefore I run 2 other
cases
along with the original example (case 1), with the expectation I'll get the
point from the output. The three cases only differ in the index I gave for
"Ksub".
### Script start####
library(mvtnorm)
library(multcomp)
data("cholesterol")
summary(cholesterol)
### adjusted p-values for all-pairwise comparisons in a one-way layout
### set up ANOVA model
amod <- aov(response ~ trt, data = cholesterol)
### set up multiple comparisons object for all-pair comparisons
cht <- glht(amod, linfct = mcp(trt = "Tukey"))
summary(cht, test = adjusted("Westfall"))
### use only a subset of all pairwise hypotheses
K <- contrMat(table(cholesterol$trt), type="Tukey")
Ksub <- rbind(K[c(1,2,5),],"D - test" = c(-1, -1, -1, 3, 0),"E
- test" c(-1, -1, -1, 0, 3))
### reproduce results in Westfall et al. (1999, page 172)
amod <- aov(response ~ trt - 1, data = cholesterol)
# case 1
summary(glht(amod, linfct = mcp(trt = Ksub[,5:1])),test
adjusted("Westfall"))
# case 2
summary(glht(amod, linfct = mcp(trt = Ksub[,1:5])),test
adjusted("Westfall"))
# case 3
summary(glht(amod, linfct = mcp(trt = Ksub[,])),test =
adjusted("Westfall"))
## end of script
All help are much appreciated.
--
Agus Susanto
[[alternative HTML version deleted]]