Learn R Programming

preseqR (version 4.0.0)

preseqR.simu.hist: 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.

Value

A two-column matrix. The first column is the frequency \(j = 1,2,\dots\); 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.

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.

Examples

Run this code
# NOT RUN {
## 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)
# }

Run the code above in your browser using DataLab