Learn R Programming

perfectphyloR (version 0.2.1)

MantelTest: Mantel test for association of two distance matirces

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

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

Run this code
# NOT RUN {
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)


# }

Run the code above in your browser using DataLab