mantel_test: Mantel test \loadmathjax

Description Usage Arguments Value Author(s) See Also Examples

View source: R/mantel_test.R

Description

[Stable]

Performs a Mantel test between two correlation/distance matrices. The function calculates the correlation between two matrices, the Z-score that is is the sum of the products of the corresponding elements of the matrices and a two-tailed p-value (null hypothesis: \mjsdeqnr = 0).

Usage

1
mantel_test(mat1, mat2, nboot = 1000, plot = FALSE)

Arguments

mat1, mat2

A correlation matrix or an object of class dist.

nboot

The number of permutations to be used. Defaults to 1000.

plot

if plot = TRUE, plots the density estimate of the permutation distribution along with the observed Z-score as a vertical line.

Value

Author(s)

Tiago Olivoto tiagoolivoto@gmail.com

See Also

pairs_mantel()

Examples

1
2
3
4
5
6
library(metan)
# Test if the correlation of traits (data_ge2 dataset)
# changes between A1 and A2 levels of factor ENV
A1 <- corr_coef(data_ge2 %>% subset(ENV == "A1"))[["cor"]]
A2 <- corr_coef(data_ge2 %>% subset(ENV == "A2"))[["cor"]]
mantel_test(A1, A2, plot = TRUE)

metan documentation built on Nov. 10, 2021, 9:11 a.m.