test {tabula}R Documentation

Diversity Test

Description

Compares Shannon/Simpson diversity between samples.

Usage

test_shannon(x, y, ...)

test_simpson(x, y, ...)

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

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

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

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

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

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

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()).

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.

Functions

Author(s)

N. Frerebeau

References

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

Examples

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

[Package tabula version 3.1.0 Index]