data(cholesterol)
# adjusted p-values for all-pairwise comparisons in a one-way
# layout (tests for restricted combinations)
simtest(response ~ trt, data=cholesterol, type="Tukey", ttype="logical")
# some examples for the formula interface, statistically non-sense!
# response
y <- rnorm(21)
# three factors
f1 <- factor(c(rep(c("A", "B", "C"), 7)))
f2 <- factor(c(rep("D", 10), rep("E", 11)))
# and one continuous covariable
x <- rnorm(21)
testdata <- cbind(as.data.frame(y), f1, f2, x)
# one factor only
summary(simtest(y ~ f1))
# one factor only, the same
summary(simtest(y ~ f1, data=testdata))
# and a continuous covariable
summary(simtest(y ~ f1 + x, data=testdata))
# without intercept
summary(simtest(y ~ f1 + x - 1, data=testdata))
# with an additional factor as covariable
# use `whichf' to specify the term in the model to
# calculate p-values or confidence intervals for
summary(simtest(y ~ f1 + f2 + x - 1, data=testdata, whichf="f1"))
# with interaction terms
summary(simtest(y ~ f1*f2 + x - 1, data=testdata, whichf="f1"))
# inference about the interactions term
# either Tetrade contrasts
summary(simtest(y ~ f1:f2, data=testdata, type="Tetrade"))
# or a user-defined contrast matrix
# note: this is a contrast matrix for the interactions only,
# the column for the intercept is added automatically
simtest(y ~ f1:f2, data=testdata, cmatrix=diag(6))
# works too, if the column for the intercept is included
summary(simtest(y ~ f1:f2, data=testdata, cmatrix=cbind(0, diag(6))))
# additional covariable
summary(simtest(y ~ f1:f2 + x, data=testdata, cmatrix=diag(6)))
# again with intercept and covariables in included in cmatrix
summary(simtest(y ~ f1:f2 + x, data=testdata,
cmatrix=cbind(0, diag(6), 0)))
Run the code above in your browser using DataLab