Constructs a zero-inflated density function from a given probability density function
Usage
zero_inflate(dist, discrete = NULL)
Value
zero-inflated density function with first argument x, second argument zeroprob, and additional arguments ... that will be passed to dist.
Arguments
dist
either a probability density function or a probability mass function
discrete
logical; if TRUE, the density for x = 0 will be zeroprob + (1-zeroprob) * dist(0, ...). Otherwise it will just be zeroprob.
In standard cases, this will be determined automatically. For non-standard cases, set this to TRUE or FALSE depending on the type of dist. See details.
Details
The definition of zero-inflation is different for discrete and continuous distributions.
For discrete distributions with p.m.f. \(f\) and zero-inflation probability \(p\), we have
$$\Pr(X = 0) = p + (1 - p) \cdot f(0),$$ and
$$\Pr(X = x) = (1 - p) \cdot f(x), \quad x > 0.$$
For continuous distributions with p.d.f. \(f\), we have
$$f_{\text{zinfl}}(x) = p \cdot \delta_0(x) + (1 - p) \cdot f(x),$$
where \(\delta_0\) is the Dirac delta function at zero.