run_betadisper: Multivariate homogeneity of groups dispersions (variances)

View source: R/gv_betadisper.R

run_betadisperR Documentation

Multivariate homogeneity of groups dispersions (variances)

Description

The run_betadisper function is a multivariate analogue of Levene's test for homogeneity of variances.

Usage

run_betadisper(
   object,
   level = c(NULL, "Kingdom", "Phylum", "Class",
           "Order", "Family", "Genus",
           "Species", "Strain", "unique"),
   variable,
   type = c("median","centroid"),
   method = c("unifrac", "wunifrac", "GUniFrac", "bray", "dpcoa", "jsd"),
   seedNum = 123,
   alpha = 0.5)

Arguments

object

(Required). a phyloseq::phyloseq or SummarizedExperiment::SummarizedExperiment object.

level

(Optional). character. Summarization level (from rank_names(pseq), default: NULL).

variable

(Required). character. grouping variable for test.

type

(Optional). character. the type of analysis to perform. Use the spatial "median" or the group "centroid" (default: "median").

method

(Optional). character. Provide one of the currently supported options. See distanceMethodList for a detailed list of the supported options and links to accompanying documentation. Options include:

  • "bray": bray crutis distance.

  • "unifrac" : unweighted UniFrac distance.

  • "wunifrac": weighted-UniFrac distance.

  • "GUniFrac": The variance-adjusted weighted UniFrac distances (default: alpha=0.5).

  • "dpcoa": sample-wise distance used in Double Principle Coordinate Analysis.

  • "jsd": Jensen-Shannon Divergence. Alternatively, you can provide a character string that defines a custom distance method, if it has the form described in designdist (default: "bray").

seedNum

(Optional). numeric. specify seeds for reproduction (default: 123).

alpha

(Optional). numeric. the parameter for "GUniFrac" controlling weight on abundant lineages (default: 0.5).

Details

One measure of multivariate dispersion (variance) for a group of samples is to calculate the average distance of group members to the group centroid or spatial median (both referred to as 'centroid' from now on unless stated otherwise) in multivariate space. To test if the dispersions (variances) of one or more groups are different, the distances of group members to the group centroid are subject to ANOVA. This is a multivariate analogue of Levene's test for homogeneity of variances if the distances between group members and group centroids is the Euclidean distance. See ?vegan::betadisper for more details. It can be applied to both phyloseq::phyloseq and SummarizedExperiment::SummarizedExperiment object.

Value

A betadisper model.

Author(s)

Created by Hua Zou (5/15/2022 Shenzhen China)

References

Anderson, Marti J., Kari E. Ellingsen, and Brian H. McArdle. "Multivariate dispersion as a measure of beta diversity." Ecology letters 9.6 (2006): 683-693.

Examples


## Not run: 
# phyloseq object
data("Zeybel_2022_gut")
run_betadisper(Zeybel_2022_gut,
   level = "Phylum",
   variable = "LiverFatClass",
   method = "bray")

# SummarizedExperiment object
data("Zeybel_2022_protein")
run_betadisper(Zeybel_2022_protein,
   variable = "LiverFatClass",
   method = "bray")

## End(Not run)


HuaZou/MicrobiomeAnalysis documentation built on May 13, 2024, 11:10 a.m.