## Poisson-lognormal distribution

### Description

Density, distribution function, quantile function and random generation for Poisson-lognormal distribution with parameters `mu` and `sigma`.

### Usage

```dpoilog( x, mu, sig, log=FALSE)
ppoilog( q, mu, sig, lower.tail=TRUE, log.p=FALSE)
qpoilog( p, mu, sig, lower.tail = TRUE, log.p = FALSE)
rpoilog( n, mu, sig)
```

### Arguments

 `x` vector of (non-negative integer) quantiles. Usually a vector of abundances of species in a sample. `q` vector of (non-negative integer) quantiles. Usually a vector of abundances of species in a sample. `n` number of random values to return. `p` vector of probabilities. `mu,sig` parameters of the compounding lognormal distribution (see details). `log, log.p` logical; if TRUE, probabilities p are given as log(p). `lower.tail` logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x].

### Details

A compound Poisson-lognormal distribution is a Poisson probability distribution where its single parameter lambda is a random variable with lognormal distribution. The density function is

p(x) = (exp(x*mu + x^2*sig/2)*(2*pi*sig)^(-1/2))/x! * g(y)

where

g(y) = int_-infty^infty exp(-exp(y))*exp(((-y-mu-x*sig)^2)/(2*sig)) dy

(Bulmer 1974 eq.5). For x = 0, 1, 2, ... .

In ecology, this distribution gives the probability that a species has an abundance of x individuals in a random sample of a fraction 'f' of the community. In the community, the species abundances are independent random variables that follow a lognormal density function, with parameters (mu + ln(f), sigma) (Engen et al. 2002).

Hence, a Poisson-lognormal distribution is a model for species abundances distributions (SAD) in a sample taken from a community under the assumptions: (a) species abundances in the community are independent identically distributed lognormal variables, (b) sampling is a Poisson process with expected value E[x]= f*n where n is the abundance in the community and f the fraction of individuals sampled, (c) individuals are sampled with replacement, or the fraction of total individuals sampled is small enough to approximate a sample with replacement. See Engen (1977) and Alonso et al. (2008) for critical evaluations.

### Value

'dpoilog' gives the (log) density of the density, 'ppoilog' gives the (log) distribution function, 'qpoilog' gives the quantile function.

### Source

These functions were built from `dpoilog` function from poilog package (Vidar Grøtan and Steinar Engen).

`dpoilog` is just a wrapper of `poilog::dpoilog` with an additional `log` argument.

`ppoilog` does the cumulative sum of `poilog::dpoilog`.

`qpoilog` uses modified bisection method to find numerically quantiles using `ppoilog`.

`rpoilog` selects random values from a poilog distribution. It is unrelated to the function of the same name in poilog.

### References

Alonso, D. and Ostling, A., and Etienne, R. S. 2008 The implicit assumption of symmetry and the species abundance distribution. Ecology Letters, 11: 93-105.

Bulmer,M. G. 1974. On Fitting the Poisson Lognormal Distribution to Species-Abundance Data. Biometrics, 30: 101-110.

Grøtan V. and Engen S. 2008. poilog: Poisson lognormal and bivariate Poisson lognormal distribution. R package version 0.4.

Engen, S. 1977. Comments on two different approaches to the analysis of species frequency data. Biometrics, 33: 205-213.

Engen, S., R. Lande, T. Walla & P. J. DeVries. 2002. Analyzing spatial structure of communities using the two-dimensional Poisson lognormal species abundance model. American Naturalist 160: 60-73.

dpois, dlnorm; dpoilog and rpoilog in poilog package; `rsad` for random generation, `fitpoilog` for maximum likelihood estimation.