Use R for Mantel Test for Correlation of Diversity v. Soil Properties
0
0
Entering edit mode
6.3 years ago
mollysil ▴ 40

I am using R Studio (vegan package) to run mantel tests to see if the microbial species diversity in my samples was correlated with specific soil properties (such as, nitrogen or soil pH). (This is hopefully a very simplistic answer for someone more familiar with the R vegan package than myself).

I am able to run a mantel test using the entirety of both of my dissimilarity matrices (one for species and one for soil properties). However, I cannot figure out how to run individual mantel tests on individual soil properties (say, just on soil pH).

My data is formatted correctly (rows are sites and columns are species or soil properties), I just need the code for running it on a portion of my data.

This is the code I ran:

bray.dist.otu<-vegdist(species_data, method = "bray") #using rarefied species data

bray.dist.soil<-vegdist(soil_data, method = "bray") #using scaled soil data

bray.mantel<-mantel(bray.dist.otu, bray.dist.soil, permutations = 999)

bray.mantel

R Output:

Mantel statistic based on Pearson's product-moment correlation 

Call:
mantel(xdis = bray.dist.otu, ydis = bray.dist.soil, permutations = 999) 

Mantel statistic r: 0.4063 
      Significance: 0.001 

Upper quantiles of permutations (null model):
   90%    95%  97.5%    99% 
0.0678 0.0922 0.1088 0.1227 
Permutation: free

Number of permutations: 999

Question: How would I get it to run the mantel test on just one column of my soil data against my species data? (aka: is there an argument to use for just one column instead of the entirety of the dataset?)

mantel test R diversity soil • 6.9k views
ADD COMMENT
1
Entering edit mode

The mantel() function takes two dissimilarity matrices as input so just compute a distance matrix using the part of the data you need, e.g. vegdist(soil_data[, 3], method = "bray"). Or am I missing something ?

ADD REPLY
0
Entering edit mode

Thank you!! I figured it would be something obvious like that.

ADD REPLY
0
Entering edit mode

HI could you please send me the script to run mantel tests to see if the microbial species diversity in my samples was correlated with specific soil properties (such as, nitrogen or soil pH).

ADD REPLY

Login before adding your answer.

Traffic: 2700 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6