rdoublebinom: The Double Binomial Distribution

Description Usage Arguments Details Value Author(s) References Examples

View source: R/doublebinom.R

Description

Density and random generation for the double binomial distribution

Usage

1
2
ddoublebinom(x = NULL, size, p, psi, log = FALSE)
rdoublebinom(n = 1, size, prob, psi)

Arguments

n

number of observations

size

number of trials

p

probability parameter, same as prob

prob

probability parameter

psi

dispersion parameter. Negative values indicate over-dispersion and positive values give under-dispersed data.

x

value to evaluate density at. If null, the entire distribution is returned.

log

logical; if TRUE, probabilities p are given as log(p).

Details

Both functions first evaluate the density at all possible values of x, and then calculate the normalising constant. To generate random variables a uniform random variable is then called and the interval it falls into on the cumulative density is the value of the random variable returned.

Value

ddoublebinom gives the density and rdoublebinom generates random deviates.

If x is null, then the density at all values in the support is returned. Note that the indexing of this vector is out by one (i.e. the first element corresponds to x=0).

Author(s)

Richard Wilkinson

References

See Efron 1986 for the density function.

Examples

1
2
3
rdoublebinom(n=10, size=12, p=0.1, psi=0.2)
ddoublebinom(x=1, size=12, p=0.1, psi=0.2)
ddoublebinom(size=12, p=0.1, psi=0.2)

rich-d-wilkinson/precision documentation built on May 27, 2019, 7:41 a.m.