# Shannon's Diversity Re-sampler

### Description

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.

### Usage

1 |

### Arguments

`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" |

### Details

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.

### Value

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

### Author(s)

Matthew K. Lau and Raj Whitlock

### See Also

`sample`

, `Gd`

, `Hs`

, `count`

### Examples

1 2 |