# Touchard: The Touchard Distribution In touchard: Touchard Model and Regression

## Description

Density, normalizing constant, distribution function, quantile function and random number generation for the Touchard distribution with Poisson-like parameter equal to `lambda` and shape/dispersion parameter equal to `delta`.

## Usage

 ```1 2 3 4 5``` ```dtouch(x, lambda, delta, N=NULL, eps=sqrt(.Machine\$double.eps), log = FALSE) ptouch(x, lambda, delta, N=NULL, eps=sqrt(.Machine\$double.eps)) qtouch(p, lambda, delta, N=NULL, eps=sqrt(.Machine\$double.eps)) rtouch(n, lambda, delta, N=NULL, eps=sqrt(.Machine\$double.eps)) tau(lambda, delta, N=NULL, eps=sqrt(.Machine\$double.eps)) ```

## Arguments

 `x` vector of quantiles `p` vector of probabilities. `n` number of observations. `lambda` Poisson-like (location) parameter which corresponds to the mean of the distribution when `delta` = 0 `delta` shape/dispersion parameter which produces unequal dispersion (var x mean) when different from zero and mild zero excess compared to the Poisson distribution `N` number of terms in the computation (series) of the normalizing constant. If `NULL` a recursion formula is used and iterated until the specified relative error is reached. `eps` relative error in the computation (series) of the normalizing constant. Only used if `N=NULL`. See reference for details. `log` logical; if TRUE, probability p is given as log(p).

## Details

The Touchard distribution with parameters λ and δ has density

[ lambda^x (x+1)^delta ] / [ x! tau(lambda,delta) ]

for y=0,1,2,..., λ > 0 and δ real.

## Value

`dtouch` gives the density, `ptouch` gives the distribution function, `qnorm` gives the quantile function, and `rtouch` generates random deviates.

`rtouch` uses the inverse transform method. The length of the result is determined by `n` and is the maximum of the lengths of the numerical arguments for the other functions. The numerical arguments other than `n` are recycled to the length of the result.

`qtouch` uses an initial approximation based on the Cornish-Fisher expansion followed by a search in the appropriate direction.

`tau` gives the value of the normalizing constant in the Touchard density.

## References

Matsushita RY, Pianto D, Andrade BB, Cancado A, Silva S (2018) The Touchard distribution, Communications in Statistics - Theory and Methods, <doi:10.1080/03610926.2018.1444177>

`rgram` , `touplot`
 ```1 2 3 4 5 6``` ```for(N in c(2, 5, 10, 20, 50)) print( tau(lambda=7, delta=-1, N) ) tau(lambda=7, delta=-1) dtouch(0:10, lambda=7, delta=-1) ptouch(0:10, lambda=7, delta=-1) qtouch(c(.1,.25,.5,.75,.9), lambda=7, delta=-1) rtouch(10, lambda=7, delta=-1) ```