Cross Validated Asked by Ian Lane on December 18, 2021
Currently I am trying to look at the correlation between three matrices of ecological data. All three are forms of distance matrices (two matrices of pairwise community dissimilarities and one matrix of pairwise site distances), but I am not actually interested in all pairwise comparisons. The sites in my study have two states, lets say A and B, and I am only interested in pairwise comparisons when they are between sites with state A and B (AB), and not between sites of state A (AA) or B (BB). My problem is how to effectively analyse this subset of the distance matrices in a valid way that accounts for non-independence.
My first thought on how to accomplish this was to generate new matrices with only the comparisons I am interested in, then use a partial Mantel test to test for a relationship while controlling for geographic distance between sites. This results in matrices that look more like traditional matrices rather than the symmetrical distance matrix that are typically used in these tests. Here are some examples of these new matrices, all sites of state A are in the row position, and all sites of sate B are in the column position.
set.seed(2020720)
dmat1<- matrix(rbeta(100,shape1 = .6,shape2 = .6), nrow=10,ncol=10)
rownames(dmat) <- LETTERS[1:10]
colnames(dmat) <- LETTERS[11:20]
dmat2<- matrix(rbeta(100,shape1 = .6,shape2 = .6), nrow=10,ncol=10)
rownames(dmat2) <- LETTERS[1:10]
colnames(dmat2) <- LETTERS[11:20]
dmat3<- matrix(abs(rnorm(100,10,50)), nrow=10,ncol=10)
rownames(dmat3) <- LETTERS[1:10]
colnames(dmat3) <- LETTERS[11:20]
I can run a partial mantel test on these matrices using the vegan package and it will give me an answer
mantel.partial(dmat1, dmat2, dmat3, method = "pearson", permutations = 2000)
But the odd thing I’ve noticed, quite by accident, is that if you transpose the sites that are in the row position with those in the column position, you can get a fairly different answer (i.e sites of state A now in column position and sites of state B in row position)
tmat1<- t(dmat1)
tmat2<- t(dmat2)
tmat3<- t(dmat3)
mantel.partial(tmat1, tmat2, tmat3, method = "pearson", permutations = 2000)
The Mantel r and p value can change substantially. In my case, the change in positions can change from a significant result to a non-significant result. I’ve been trying to figure out why this could be, but I admittedly don’t fully understand Mantel tests. I’ve tried different packages (ncf package), but have similar problems. I suspect my issue might be related to the type of matrix I am using, but if the Mantel test is "unspooling" the matrix to do permutations why would this matter? Is there a different method I should be considering?
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP