This function is a wrapper for `sample`

and can be used to determine the expected value of a diversity index under a specified sampling intensity. A Monte-Carlo procedure is used to re-sample a given observation with replacement at each user-specified sampling intensity. The resampling can take place through one of two schemes. First, where the observed frequencies of species are assumed to represent the true underlying values, and second, where a user-specified vector of probabilities is used to control the resampling. The function calculates a diversity index over each simulated sample and summarises these for each specified level of sampling intensity via their mean.

1 |

`x` |
A community matrix with observations in rows and species in columns. |

`n` |
A vector or scalar of sample size(s). |

`nit` |
Number of iterations of the Monte-Carlo procedure. |

`base` |
The base of the logarithm used to calculate Shannon's index (DEFAULT = e). |

`corr` |
Correction factor for small sample sizes. |

`p` |
A vector or matrix of weights corresponding to x, which can be used to simulate scenarios where forces other than sampling impact diversity. |

`method` |
The diversity metric: "Shannon" or "Gene diversity" |

The Monte-Carlo procedure draws random individuals based on the relative abundances of the species in a given observation. This process is repeated for the number of specified iterations at each designated sample level. For each iteration, the diversity index is calculated, and the mean is taken from all the indices produced in each iteration.

A matrix of diversity indices for each observation (rows) at each sampling level (columns).

Matthew K. Lau and Raj Whitlock

1 2 |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.