MantelTest: Mantel test for association of two distance matirces

Description Usage Arguments Value References Examples

View source: R/mantel_test.R

Description

This function performs Mantel test for correlation between two distance matrices. It computes P value by randomly permuting rows and columns of the second matrix.

Usage

1
MantelTest(Dx, Dy, nperm)

Arguments

Dx

A numeric matrix of pairwise distances.

Dy

A second numeric matrix of pairwise distances.

nperm

The number of times to permute the rows and columns of Dy.

Value

A list contains Mantel statistic and permutation P value.

References

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

Examples

1
2
3
4
5
6
7
x <- runif(8)
y <- runif(8)
# Distance matrices
distX = as.matrix(dist(x, upper = TRUE, diag = TRUE))
distY = as.matrix(dist(y, upper = TRUE, diag = TRUE))

MantelTest(Dx = distX, Dy = distY, nperm = 1000)

perfectphyloR documentation built on March 8, 2021, 9:06 a.m.