# [R] Multiple tests on 2 way-ANOVA

Grathwohl, Dominik, LAUSANNE, NRC-BAS dominik.grathwohl at rdls.nestle.com
Tue Jul 11 16:52:15 CEST 2006

```Dear r-helpers,

I have a question about multiple testing.
Here an example that puzzles me:
All matrixes and contrast vectors are presented in treatment contrasts.

1. example:
library(multcomp)
n<-60; sigma<-20
# n = sample size per group
# sigma standard deviation of the residuals

cov1 <- matrix(c(3/4,-1/2,-1/2,-1/2,1,0,-1/2,0,1), nrow = 3, ncol=3, byrow=TRUE,
dimnames = list(c("A", "B", "C"), c("C.1", "C.2", "C.3")))
# cov1 = variance covariance matrix of the beta coefficients of a
# 2x2 factorial design (see Piantadosi 2005, p. 509)

cm1 <- matrix(c(0, 1, 0, 0, 0, 1), nrow = 2, ncol=3, byrow=TRUE,
dimnames = list(c("A", "B"), c("C.1", "C.2", "C.3")))
# cm1 = contrast matrix for main effects

v1 <- csimint(estpar=c(100, 6, 5), df=4*n-3, covm=cov1*sigma^2/n, cmatrix=cm1, conf.level=0.95)
summary(v1)

The adjusted p-values are almost the Bonferroni p-values.
If I understood right: You need not to adjust for multiple testing
on main effects in a 2x2 factorial design
assuming the absence of interaction.
I do not think that there is a bug,
I want to understand, why multcomp does adjust for multiple tests
having all information about the design of the trial (variance covariance matrix)?

2. example:
And I have second question: How do I proper correct for multiple testing
if I want to estimate in the presence of interaction the two average main effects.
Can some one point me to some literature where I can learn these things?
Here the example, 2x2 factorial with interaction, estimation of average main effects:

cov2 <- matrix(
c(1,-1,-1, 1,
-1, 2, 1,-2,
-1, 1, 2,-2,
1,-2,-2, 4)
, nrow=4, ncol=4, byrow=TRUE)
cm2 <- matrix(c(0, 1, 0, 1/2, 0, 0, 1, 1/2), nrow = 2, ncol=4, byrow=TRUE,
dimnames = list(c("A", "B"), c("C.1", "C.2", "C.3", "C.4")))
v2 <- csimint(estpar=c(100, 6, 5, 2), df=4*n-4, covm=cov2*sigma^2/n, cmatrix=cm2, conf.level=0.95)
summary(v2)

I do not believe that this is the most efficient way for doing this,

My R.version:

platform i386-pc-mingw32
arch     i386
os       mingw32
system   i386, mingw32
status
major    2
minor    2.1
year     2005
month    12
day      20
svn rev  36812
language R

```