Differences in sampling effort impact Bray-Curtis distances and rarefaction can minimize it (CC191)
Channel: Riffomonas Project
Date: 2022-02-28

Bray-Curtis distances are impacted by the difference the number of observations for each sample being compared. Here Pat shows that the average distance is constant when using rarefaction whereas it is more variable with not rarefying, using relative abundance, or normalization. He shows how to do this analysis using ggplot2's cut_width function. He'll also show how to generate a density plot of the distributions and use geom_smooth to get an overall sense of the variation in the data. He'll show how to synthesize and visualize the data using tools from dplyr, ggplot2, and other tidyverse packages.

You can find my blog post for this episode at https://www.riffomonas.org/code_club/2022-02-28-variation-with-difference. The data were generated in our Kozich et al. 2013 paper (http://doi.org/10.1128/AEM.01043-13) using samples from the Schloss et al. 2012 paper (http://doi.org/10.4161/gmic.21008).

#cut_width #geom_smooth #geom_density #ggplot2 #R #Rstudio #Rstats

Want more practice on the concepts covered in Code Club? You can sign up for my weekly newsletter at https://shop.riffomonas.org/youtube to get practice problems, tips, and insights.

If you're interested in taking an upcoming 3 day R workshop be sure to check out our schedule at https://riffomonas.org/workshops/

You can also find complete tutorials for learning R with the tidyverse using...
Microbial ecology data: https://www.riffomonas.org/minimalR/
General data: https://www.riffomonas.org/generalR/

0:00 How to discretize a continuous variable
4:27 Comparing distributions with a density plot
6:59 Looking at general trends with geom_smooth
7:42 Turning a continuous variable into a discrete variable with cut_width
10:43 Summarizing distances by binned distances
11:45 Plotting the average distance
13:23 Plotting summary statistics as facets