Question: Use R for Mantel Test for Correlation of Diversity v. Soil Properties
0
gravatar for mollysil
10 months ago by
mollysil0
mollysil0 wrote:

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?)

soil mantel test R diversity • 1.1k views
ADD COMMENTlink modified 11 weeks ago by samisheen140 • written 10 months ago by mollysil0
1

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 REPLYlink written 10 months ago by Jean-Karim Heriche16k

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

ADD REPLYlink written 10 months ago by mollysil0

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 REPLYlink written 11 weeks ago by samisheen140
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1985 users visited in the last hour