Learn R Programming

touchard (version 2.0.1)

Touchard: The Touchard Distribution

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

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).

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.

Details

The Touchard distribution with parameters \(\lambda\) and \(\delta\) has density $$f(x) = \frac{\lambda^x (x+1)^{\delta}}{x! \tau(\lambda,\delta)}$$ for \(y=0,1,2,...\), \(\lambda > 0 \) and \(\delta\) real.

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>

See Also

rgram , touplot

Examples

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

Run the code above in your browser using DataLab