Mahalanobis Distance Test for GMPMs

Description

Performs multiparameter tests on GMPM objects (or matrices) using Mahalanobis distances calculated on the permutation matrix.

Usage

1
mdTest(x, y)

Arguments

x

Either a GMPM object or a permutation matrix

y

Either a list of vectors, or a single vector. The vector (or vectors) should index the columns of the matrix on which to perform the test. They can either be numeric indices or the names of the matrix columns. If y is a list, then a separate test will be performed for each vector in the list.

Value

A Mdtest object

See Also

S4 classes Mdtest, GMPM, and function gmpm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# create a within-subjects design
# we are interested in main effect of A (3-level variable)
# this requires a multivariate test
df1 <- data.frame(SubjID=rep(1:12,each=6),
                  A=rep(c("Aa","Ab","Ac"),each=2),
                  B=c("Ba","Bb"))
df1$Y <- rep(c(0,1,-1),each=2) + rnorm(72)

# parametric analysis
summary(aov(Y ~ A*B + Error(SubjID), df1))

# randomization analysis; should increase maxruns to something like 999
df1.gmpm <- gmpm(Y ~ A*B | SubjID, gaussian, df1, c("A","B"),
                 gmpmControl=list(maxruns=99))

# retrieve the permutation matrix
pmx <- getPermMx(df1.gmpm)[["within"]]

# perform test using permutation matrix
mdTest(pmx, c("A1","A2"))