Learn R Programming

ncf (version 1.1-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) cotrolling for M3 (M2). syntax and logic follows Legendre and Legendre (1998) pp 557-558

Usage

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

Arguments

M1, M2, M3
similarity/distance matrices 1, 2 and 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 supressed during execution.

Value

  • An object of class "partial.Mantel" is returned, consisting of a list with two components:
  • MantelRthe vector of observed Mantel and partial Mantel correlations.
  • pis the vector of two-sided p-value under randomization (of M1).

Details

Missing values are 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
#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=10)

Run the code above in your browser using DataLab