This is an implementation of the DOC analysis proposed by Bashan et al. 2016 Universality of human microbial dynamics. Nature 534
Instead of calculating the Fns value only once on the observed data, an Fns value is calculated for each bootstrap realization making it possible to asses the robustness of the measure. Besides this, I inteded to mimic the orignal Matlab code as much as possible, although note that the robust lo(w)ess algorithms in R and Matlab might give slightly different results.
The function runs in parallel, set the cores
argument to enable this.
library(devtools)
install_github("Russel88/DOC")
# Plotting requires the ggplot2 package
install.packages("ggplot2")
results <- DOC(otu)
The input is an OTU-table with taxa as rows
plot(results)
The vertical line is the median Overlap at which the fitted line has a negative slope.
results.null <- DOC.null(otu)
# The names (res1, res2, and res3) will appear in the plot
merged <- DOC.merge(list(res1 = results1, res2 = results2, res3 = results3))
plot(merged)
# If you merge a "real"" analysis with a "null" give them the same name:
merged <- DOC.merge(list(MyResults = results, MyResults = results.null))
plot(merged)