#library("devtools")
#install_github("microbiome/microbiome")
This page provides an example of running the dissimilarity-overlap analysis as proposed in Bashan, A., Gibson, T., Friedman, J. et al. Universality of human microbial dynamics. Nature 534, 259–262 (2016). DOI:10.1038/nature18301.
Load example data:
# Dissimilarity-Overlap analysis
library(microbiome)
data(atlas1006)
Estimate the overlap and dissimilarity quantities:
# Dissimilarity
d <- phyloseq::distance(microbiome::transform(atlas1006, "compositional"), "jsd", parallel=TRUE)
# Overlap
o <- overlap(atlas1006, detection = 0.2/100)
# Compare
dvec <- d[lower.tri(d)]
ovec <- o[lower.tri(o)]
# Assess rough correlation
cc <- cor(dvec, ovec, method = "spearman", use = "pairwise.complete.obs")
# Scatterplot
plot(dvec, ovec, pch = ".", main = paste("Spearman rho", round(cc, 2)), las = 1, xlab = "Dissimilarity (Jensen-Shannon)", ylab = "Overlap")
#p <- data.frame(D = dvec, O = ovec) %>%
# ggplot(aes(x = D, y = O)) +
# geom_hex()