divergence: Divergence within a Sample Group

View source: R/divergence.R

divergenceR Documentation

Divergence within a Sample Group

Description

Quantify microbiota divergence (heterogeneity) within a given sample set with respect to a reference.

Usage

divergence(x, y, method = "bray")

Arguments

x

phyloseq object or a vector

y

Reference sample. A vector.

method

dissimilarity method: any method available via phyloseq::distance function. Note that some methods ("jsd" and 'unifrac' for instance) do not work with the group divergence.

Details

Microbiota divergence (heterogeneity / spread) within a given sample set can be quantified by the average sample dissimilarity or beta diversity with respect to a given reference sample.

This measure is sensitive to sample size. Subsampling or bootstrapping can be applied to equalize sample sizes between comparisons.

Value

Vector with dissimilarities; one for each sample, quantifying the dissimilarity of the sample from the reference sample.

Author(s)

Leo Lahti microbiome-admin@googlegroups.com

References

To cite this R package, see citation('microbiome')

See Also

the vegdist function from the vegan package provides many standard beta diversity measures

Examples

# Assess beta diversity among the African samples
# in a diet swap study (see \code{help(dietswap)} for references)
data(dietswap)
pseq <- subset_samples(dietswap, nationality == 'AFR')
reference <- apply(abundances(pseq), 1, median)
b <- divergence(pseq, reference, method = "bray")


microbiome/microbiome documentation built on Aug. 22, 2023, 7:12 a.m.