Learn R Programming

ncf (version 1.3-2)

partial.mantel.test: Partial Mantel test

Description

A simple function to calculate permutation-based partial mantel tests for three matrices, the partial mantel test is calculated to test for relationships between M1 and M2 (M3) controlling for M3 (M2). syntax and logic follows Legendre and Legendre (1998) pp 557-558.

Usage

partial.mantel.test(
  M1,
  M2,
  M3,
  resamp = 999,
  method = "pearson",
  quiet = FALSE
)

Arguments

M1

similarity/distance matrix 1

M2

similarity/distance matrix 2

M3

similarity/distance matrix 3

resamp

the number of resamples for the null distribution.

method

the method to be used for calculating the correlations.

quiet

If TRUE, the counter is suppressed during execution.

Value

An object of class "partial.Mantel" is returned, consisting of a list with two components:

MantelR

the vector of observed Mantel and partial Mantel correlations.

p

the vector of two-sided p-value under randomization (of M1).

Details

Missing values are treated through pairwise deletion.

The method must be one of "pearson" (default), "spearman" or "kendall".

References

Legendre, P., and L. Legendre. 1998. Numerical Ecology, 2nd edition. Elsevier, Amsterdam

See Also

mantel.test

Examples

Run this code
# NOT RUN {
# first generate some sample data and dissimilarity matrices
x <- rnorm(10)
y <- rnorm(10)
z <- rnorm(10)
M1 <- sqrt(outer(x, x, "-")^2)
M2 <- sqrt(outer(y, y, "-")^2)
M3 <- sqrt(outer(z, z, "-")^2)

partial.mantel.test(M1 = M1, M2 = M2, M3 = M3, resamp = 999)
# }

Run the code above in your browser using DataLab