## S3 method for class 'default':
simtest(y, x=NULL, type=c("Dunnett", "Tukey",
"Sequen", "AVE", "Changepoint", "Williams", "Marcus",
"McDermott","Tetrade"), cmatrix=NULL,
alternative=c("two.sided","less", "greater"),
asympt=FALSE, ttype=c("free","logical"), eps=0.001,
maxpts=1e+06, nlevel=NULL, nzerocol=c(0,0),...)
## S3 method for class 'formula':
simtest(formula, data=list(), subset, na.action, whichf, ...)
cmatrix
is defined, type
is ignored."two.sided"
(default), "greater"
or
"less"
. You can specify just the initial letter.type == "Tetrade"
.nzerocol
is automaticaEnvironment(formula)
, typically the environment from which
simint
is called.NA
's. Defaults to
GetOption("na.action")
.formula
, whichf
can be used to defined the factor to compute
contrasts of.hmtestp
pmvt
function. The p-values are
generally the same as the come out in a closed test procedure using max-T-type
statistics. The procedure differs in a very subtle way from closed testing,
but still controls FWE strongly under point null configurations; see Westfall
(1997).
The present function allows for multiple comparisons of generally correlated
means in general linear models under the classical ANOVA assumptions, as well
as more general approximate procedures for approximately normal and generally
correlated parameter estimates. Either multivariate normal or multivariate t
statistics can be used. The interface allows the use of the multiple comparison
procedures as for example Dunnett and Tukey. The resulting p-values are
not associated with the confidence intervals from simint
.The formula interfaces to simtest
and simint
are
able to work with the following situations at the right hand side (the left
hand side is one continuous variable).
As long as the contrasts are specified for one single factor of interest,
any ANOVA or ANCOVA model can be used. If any of the covariables is again a
factor, specify the factor of interest with
the whichf
option. The remaining (zero) columns are added automatically
to the contrast matrix (but you can also specify the number of zero
columns by hand through
nzerocol
). One exception of supplied contrasts which involve more
than one factor are the Tetrade contrasts for the analysis of two-fold
interactions (see waste
for an example).
In this case only the two-way layout model with interactions
may be specified on the right hand side of `formula' (continuous covariables
are possible). If a contrast matrix is specified (via cmatrix
) and
whichf
is missing, the complete design matrix is derived from the
right hand side of formula
is used, whenever the their dimensions
match with those of cmatrix
.
Some toy examples are given in the examples section.
In all other cases csimtest
or csimint
should be used which allow a greater flexibility and more potential
situations of use (e.g. multivariate data, contrasts involving more than 1
factor, non-linear models, ...), also the user has to compute the
estimates, df and covariance matrices on his own.
Frank Bretz, Alan Genz and Ludwig A. Hothorn (2001), On the numerical availability of multiple comparison procedures. Biometrical Journal, 43(5), 64--66.
data(cholesterol)
# adjusted p-values for all-pairwise comparisons in a onw-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