simtest {multcomp}R Documentation

Simultaneous Comparisons

Description

Computes multiplicity adjusted p-value for several multiple comparisons.

Usage

## Default S3 method:
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, ...)
## S3 method for class 'lm':
simtest(y, psubset=NULL, cmatrix = NULL, ttype=c("free","logical"),
         alternative=c("two.sided","less","greater"), asympt=FALSE,
         eps=0.001, maxpts=1000000, ...)

Arguments

y a numeric vector of responses or an object of class lm or glm.
x a numeric matrix, the design matrix.
type the type of contrast to be used. If type is not specified, cmatrix has to be specified.
cmatrix the contrast matrix itself can be specified. If cmatrix is defined, type is ignored.
alternative the alternative hypothesis must be one of "two.sided" (default), "greater" or "less". You can specify just the initial letter.
asympt a logical indicating whether the (exact) t-distribution or the normal approximation should be used.
ttype Specifies whether the logical contraint method of Westfall (1997) will be used, or whether the uncontrained method will be used.
eps absolute error tolerance as double.
maxpts maximum number of function values as integer.
nlevel a vector containing the number of levels for each factor for type == "Tetrade".
nzerocol a vector of two elements defining the number of zero-columns to add to the contrast matrix from left (the first element, usually 1 for the intercept) and right (usually 0 if no covariables are specified). nzerocol is automatically determined by simint.formula.
psubset a vector of integers or characters indicating for which subset of coefficients of a (generalized) linear model y simultaneous p-values should be computed.
formula a symbolic description of the model to be fit.
data an optional data frame containing the variables in the model. By default the variables are taken from Environment(formula), typically the environment from which simint is called.
subset an optional vector specifying a subset of observations to be used.
na.action a function which indicates what should happen when the data contain NA's. Defaults to GetOption("na.action").
whichf if more than one factor is given in the right hand side of formula, whichf can be used to defined the factor to compute contrasts of.
... further arguments to be passed to or from methods.

Details

Computes multiplicity adjusted p-value for several multiple comparisons. The implemented algorithms take the logical relationships between the hypotheses and the stochastical correlations between the test statistics into account. Logical information is included via the methods described by Westfall (1997). Stochastic information is included via the 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.

Value

an object of class hmtestp

Author(s)

Frank Bretz <bretz@ifgb.uni-hannover.de> and
Torsten Hothorn <Torsten.Hothorn@rzmail.uni-erlangen.de>

References

Peter Westfall (1997), Multiple testing of general contrasts using logical constraints and correlations. Journal of the American Statistical Association 92(437), 299-36.

Frank Bretz, Alan Genz and Ludwig A. Hothorn (2001), On the numerical availability of multiple comparison procedures. Biometrical Journal, 43(5), 64–66.

Examples

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)))


[Package multcomp version 0.4-8 Index]