divergence: Divergence within a Sample Group

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/divergence.R

Description

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

Usage

1
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

1
2
3
4
5
6
# 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 documentation built on Nov. 8, 2020, 5:08 p.m.