Learn R Programming

biotools (version 2.2)

mantelTest: Mantel's Permutation Test

Description

Mantel's permutation test based on Pearson's correlation coefficient to evaluate the association between two distance square matrices.

Usage

mantelTest(m1, m2, nperm = 999, alternative = "greater", 
	graph = TRUE, main = "Mantel's test", xlab = "Correlation", ...)

Arguments

m1
an object of class "matrix" or "dist", containing distances among n individuals.
m2
an object of class "matrix" or "dist", containing distances among n individuals.
nperm
the number of matrix permutations.
alternative
a character specifying the alternative hypothesis. It must be one of "greater" (default), "two.sided" or "less".
graph
logical; if TRUE (default), the empirical distribution is plotted.
main
opitional; a character describing the title of the graphic.
xlab
opitional; a character describing the x-axis label.
...
further graphical arguments. See par.

Value

  • A list of
  • correlationnumeric; the observed Pearson's correlation between m1 and m2.
  • p.valuenumeric; the empirical p-value of the permutation test.
  • alternativecharacter; the alternative hypothesis used to compute p.value.
  • nullcornumeric vector containing randomized values of correlation, i.e., under the null hypothesis that the true correlation is equal to zero.

References

Mantel, N. (1967). The detection of disease clustering and a generalized regression approach. Cancer Research, 27:209--220.

See Also

mantelPower

Examples

Run this code
# Distances between garlic cultivars
data(garlicdist)
garlicdist

# Tocher's clustering
garlic <- tocher(garlicdist)
garlic

# Cophenetic distances
coph <- cophenetic(garlic)
coph

# Mantel's test
mantelTest(garlicdist, coph, 
	xlim = c(-1, 1))

# End (Not run)

Run the code above in your browser using DataLab