Skip to contents

A richness metric that normalizes the number of species by the square root of the total sample size.

Usage

menhinick(counts, margin = 1L, cpus = n_cpus())

Arguments

counts

A numeric matrix of count data (samples \(\times\) features). Typically contains absolute abundances (integer counts), though proportions are also accepted.

margin

The margin containing samples. 1 if samples are rows, 2 if samples are columns. Ignored when counts is a special object class (e.g. phyloseq). Default: 1

cpus

How many parallel processing threads should be used. The default, n_cpus(), will use all logical CPU cores.

Details

Menhinick's index is defined as: $$\frac{n}{\sqrt{X_T}}$$

Where:

  • \(n\) : The number of features.

  • \(X_T\) : Total of all counts.

Base R Equivalent:

x <- ex_counts[1,]
sum(x > 0) / sqrt(sum(x))

Input Types

The counts parameter is designed to accept a simple numeric matrix, but seamlessly supports objects from the following biological data packages:

  • phyloseq

  • rbiom

  • SummarizedExperiment

  • TreeSummarizedExperiment

For large datasets, standard matrix operations may be slow. See vignette('performance') for details on using optimized formats (e.g. sparse matrices) and parallel processing.

References

Menhinick, E. F. (1964). A comparison of some species-individuals diversity indices applied to samples of field insects. Ecology, 45(4), 859-861. doi:10.2307/1934933

See also

Examples

    menhinick(ex_counts)
#>    Saliva      Gums      Nose     Stool 
#> 0.2153528 0.1679783 0.1887016 0.2016195