I'm trying to perform a mantel test that ignores specific pairs in my
distance matrices. The reasoning is that some geographic distances
below a certain threshold suffer from spatial autocorrelation, or
perhaps ecological relationships become less relevant that stochastic
processes above a certain threshold.

The problem is that I can't find a way to do it. If I replace values
in either or both of the distance matrices with NA, mantel.rtest (ade4
package) gives the following error: Error in if (any(distmat < tol))
warning("Zero distance(s)") : missing value where TRUE/FALSE needed

Here's a trivial example that tries to exclude elements of the first
matrix that equal 11:

library(ade4)
a <- matrix(data = 1:36, nrow = 6)
b <- matrix(data = 1:36, nrow = 6)
a[a==11] <- NA
mantel.rtest(as.dist(a), as.dist(b))

Is there a way to do this, either with this package or another?

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to