bimodality: Bimodality Analysis

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

View source: R/bimodality.R

Description

Estimate bimodality scores.

Usage

1
2
3
4
5
6
7
8
9
bimodality(
  x,
  method = "potential_analysis",
  peak.threshold = 1,
  bw.adjust = 1,
  bs.iter = 100,
  min.density = 1,
  verbose = TRUE
)

Arguments

x

A vector, matrix, or a phyloseq object

method

bimodality quantification method ('potential_analysis', 'Sarle.finite.sample', or 'Sarle.asymptotic'). If method='all', then a data.frame with all scores is returned.

peak.threshold

Mode detection threshold

bw.adjust

Bandwidth adjustment

bs.iter

Bootstrap iterations

min.density

minimum accepted density for a maximum; as a multiple of kernel height

verbose

Verbose

Details

The coefficient lies in (0, 1).

The 'Sarle.asymptotic' version is defined as

b=(g^2 + 1) / k

. This is coefficient of bimodality from Ellison AM Am. J. Bot. 1987, for microbiome analysis it has been used for instance in Shade et al. 2014. The formula for 'Sarle.finite.sample' (SAS 2012):

b=\frac{g^2 + 1}{k + (3(n-1)^2)/((n-2)(n-3))}

where n is sample size and In both formulas, g is sample skewness and k is the kth standardized moment (also called the sample kurtosis, or excess kurtosis).

Value

A list with following elements:

Author(s)

Leo Lahti leo.lahti@iki.fi

References

See Also

A classical test of multimodality is provided by dip.test in the DIP package.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# In practice, use more bootstrap iterations   
b <- bimodality(c(rnorm(100, mean=0), rnorm(100, mean=5)),
    method = "Sarle.finite.sample", bs.iter=5)
# The classical DIP test:
# quantifies unimodality. Values range between 0 to 1. 
# dip.test(x, simulate.p.value=TRUE, B=200)$statistic
# Values less than 0.05 indicate significant deviation from unimodality.
# Therefore, to obtain an increasing multimodality score, use
# library(diptest)
# multimodality.dip <- apply(abundances(pseq), 1,
# function (x) {1 - unname(dip.test(x)$p.value)})

microbiome documentation built on Nov. 8, 2020, 5:08 p.m.