bimodality {microbiome} | R Documentation

## Bimodality Analysis

### Description

Estimate bimodality scores.

### Usage

    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

- Sarle.finite.sample Coefficient of bimodality for finite sample. See SAS 2012.

- Sarle.asymptotic Coefficient of bimodality, used and described in Shade et al. (2014) and Ellison AM (1987).

- potential_analysis Repeats potential analysis (Livina et al. 2010) multiple times with bootstrap sampling for each row of the input data (as in Lahti et al. 2014) and returns the bootstrap score.

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:

- scoreFraction of bootstrap samples where multiple modes are observed

- nmodesThe most frequently observed number of modes in bootstrap sampling results.

- resultsFull results of potential_analysis for each row of the input matrix.

### Author(s)

Leo Lahti leo.lahti@iki.fi

### References

- Livina et al. (2010). Potential analysis reveals changing number of climate states during the last 60 kyr. Climate of the Past, 6, 77-82.

- Lahti et al. (2014). Tipping elements of the human intestinal ecosystem. Nature Communications 5:4344.

- Shade et al. mBio 5(4):e01371-14, 2014.

- AM Ellison, Am. J. Bot 74:1280-8, 1987.

- SAS Institute Inc. (2012). SAS/STAT 12.1 user's guide. Cary, NC.

- To cite the microbiome R package, see citation('microbiome')

### See Also

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

### Examples

    # 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)})

[Package microbiome version 1.12.0 Index]