Learn R Programming

tabula (version 3.1.1)

test: Diversity Test

Description

Compares Shannon/Simpson diversity between samples.

Usage

test_shannon(x, y, ...)

test_simpson(x, y, ...)

# S4 method for numeric,numeric test_shannon(x, y, ...)

# S4 method for matrix,missing test_shannon(x, adjust = "holm", ...)

# S4 method for data.frame,missing test_shannon(x, adjust = "holm", ...)

# S4 method for numeric,numeric test_simpson(x, y, adjust = "holm", ...)

# S4 method for matrix,missing test_simpson(x, adjust = "holm", ...)

# S4 method for data.frame,missing test_simpson(x, adjust = "holm", ...)

Value

If x and y are numeric vectors, returns a list containing the following components:

statistic

The value of the t-statistic.

parameter

The degrees of freedom for the t-statistic.

p.value

The p-value for the test.

If x is a matrix or a data.frame, returns a table of adjusted p-values in lower triangular form.

Arguments

x, y

A numeric vector, a \(m \times p\) matrix or data.frame of count data (absolute frequencies giving the number of individuals for each category, i.e. a contingency table). A data.frame will be coerced to a numeric matrix via data.matrix().

...

Further arguments to be passed to internal methods.

adjust

A character string specifying the method for adjusting \(p\) values (see stats::p.adjust()).

Functions

  • test_shannon(x = matrix, y = missing): Produces two sided pairwise comparisons.

  • test_shannon(x = data.frame, y = missing): Produces two sided pairwise comparisons.

  • test_simpson(x = matrix, y = missing): Produces two sided pairwise comparisons.

  • test_simpson(x = data.frame, y = missing): Produces two sided pairwise comparisons.

Author

N. Frerebeau

References

Magurran, A. E. (1988). Ecological Diversity and its Measurement. Princeton, NJ: Princeton University Press. tools:::Rd_expr_doi("10.1007/978-94-015-7358-0").

Examples

Run this code
## Data from Magurran 1988, p. 145-149
oakwood <- c(35, 26, 25, 21, 16, 11, 6, 5, 3, 3,
             3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0)
spruce <- c(30, 30, 3, 65, 20, 11, 0, 4, 2, 14,
            0, 3, 9, 0, 0, 5, 0, 0, 0, 0, 1, 1)

test_shannon(oakwood, spruce)
test_simpson(oakwood, spruce)

## Data from Conkey 1980, Kintigh 1989
data("cantabria")

test_shannon(cantabria)
test_simpson(cantabria)

Run the code above in your browser using DataLab