partial.mantel.test | R Documentation |
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.
partial.mantel.test( M1, M2, M3, resamp = 999, method = "pearson", quiet = FALSE )
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. |
Missing values are treated through pairwise deletion.
The method must be one of "pearson" (default), "spearman" or "kendall".
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). |
Ottar N. Bjornstad onb1@psu.edu
Legendre, P., and L. Legendre. 1998. Numerical Ecology, 2nd edition. Elsevier, Amsterdam
mantel.test
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.