HHGtest: HHG test for association of two distance matrices

Description Usage Arguments Value References Examples

View source: R/HHG_test.R

Description

This function performs HHG test to find the association between two distance matrices. It permutes rows and columns of the second matrix randomly to calculate P value.

Usage

1
HHGtest(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 HHG coefficient and permutation P value.

References

Barak, B., and Shachar, K., based in part on an earlier implementation by Ruth Heller and Yair Heller. (2017). HHG: Heller-Heller-Gorfine Tests of Independence and Equality of Distributions. R package version 2.2. https://CRAN.R-project.org/package=HHG

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))

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

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