preseqR.simu.hist: Simulation

View source: R/simulation.R

preseqR.simu.histR Documentation

Simulation

Description

Generating a histogram based on a Poisson mixture model.

Usage

  preseqR.simu.hist(L=1e8, N, FUN)

Arguments

L

A positive integer, the number of species in a population.

N

A positive interger, the simulated sample size.

FUN

An RNG generating non negative real number.

Details

preseqR.simu.hist uses a mixture of Poisson distributions to generate a sample, which size is defined by the variable N. The statistical assumption is that for each species the number of individuals captured in a sample follows a Poisson process. The Poisson rates among species are generated by a given function FUN per unit of sampling effort.

FUN must take an argument indicating the number of random numbers generated and return a vector of generated numbers.

Value

A two-column matrix. The first column is the frequency j = 1,2,…; and the second column is N_j, the number of species with each species represented exactly j times in the initial sample. The first column must be sorted in an ascending order.

Author(s)

Chao Deng

Examples

## load library
library(preseqR)
## construct a RNG
f <- function(n) {
  rgamma(n, shape=0.5, scale=1)
}
## sample 10,000 individuals
preseqR.simu.hist(L=1e5, N=10000, f)

smithlabcode/preseqR documentation built on Sept. 13, 2022, 6:29 p.m.