]> git.donarmstrong.com Git - ape.git/blob - man/mantel.test.Rd
some big fixes for ape 2.7-1
[ape.git] / man / mantel.test.Rd
1 \name{mantel.test}
2 \alias{mantel.test}
3 \title{Mantel Test for Similarity of Two Matrices}
4 \usage{
5 mantel.test(m1, m2, nperm = 1000, graph = FALSE, ...)
6 }
7 \arguments{
8   \item{m1}{a numeric matrix giving a measure of pairwise distances,
9     correlations, or similarities among observations.}
10   \item{m2}{a second numeric matrix giving another measure of pairwise
11     distances, correlations, or similarities among observations.}
12   \item{nperm}{the number of times to permute the data.}
13   \item{graph}{a logical indicating whether to produce a summary graph
14     (by default the graph is not plotted).}
15   \item{\dots}{further arguments to be passed to \code{plot()} (to add a
16     title, change the axis labels, and so on).}
17 }
18 \description{
19   This function computes Mantel's permutation test for similarity of two
20   matrices. It permutes the rows and columns of the two matrices
21   randomly and calculates a Z-statistic.
22 }
23 \details{
24   The function calculates a Z-statistic for the Mantel test, equal to
25   the sum of the  pairwise product of the lower triangles of the
26   permuted matrices, for each permutation of rows and columns. It
27   compares the permuted distribution with the Z-statistic observed for
28   the actual data.
29
30   If \code{graph = TRUE}, the functions plots the density estimate of
31   the permutation distribution along with the observed Z-statistic as a
32   vertical line.
33
34   The \code{...} argument allows the user to give further options to
35   the \code{plot} function: the title main be changed with \code{main=},
36   the axis labels with \code{xlab =}, and \code{ylab =}, and so on.
37 }
38 \value{
39   \item{z.stat}{the Z-statistic (sum of rows*columns of lower triangle)
40     of the data matrices.}
41   \item{p}{P-value (quantile of the observed Z-statistic in the
42     permutation distribution).}
43 }
44 \references{
45   Mantel, N. (1967) The detection of disease clustering and a
46   generalized regression approach. \emph{Cancer Research}, \bold{27},
47   209--220.
48
49   Manly, B. F. J. (1986) \emph{Multivariate statistical methods: a primer.}
50   London: Chapman & Hall.
51 }
52 \author{Original code in S by Ben Bolker \email{bolker@zoo.ufl.edu}, ported
53   to \R by Julien Claude \email{claude@isem.univ-montp2.fr}
54 }
55 \examples{
56 q1 <- matrix(runif(36), nrow = 6)
57 q2 <- matrix(runif(36), nrow = 6)
58 mantel.test(q1, q2, graph = TRUE,
59             main = "Mantel test: a random example with 6 X 6 matrices",
60             xlab = "z-statistic", ylab = "Density",
61             sub = "The vertical line shows the observed z-statistic")
62 }
63 \keyword{multivariate}