ZeroModifiedNegativeBinomial: The Zero-Modified Negative Binomial Distribution

ZeroModifiedNegativeBinomialR Documentation

The Zero-Modified Negative Binomial Distribution

Description

Density function, distribution function, quantile function and random generation for the Zero-Modified Negative Binomial distribution with parameters size and prob, and arbitrary probability at zero p0.

Usage

dzmnbinom(x, size, prob, p0, log = FALSE)
pzmnbinom(q, size, prob, p0, lower.tail = TRUE, log.p = FALSE)
qzmnbinom(p, size, prob, p0, lower.tail = TRUE, log.p = FALSE)
rzmnbinom(n, size, prob, p0)

Arguments

x

vector of (strictly positive integer) quantiles.

q

vector of quantiles.

p

vector of probabilities.

n

number of observations. If length(n) > 1, the length is taken to be the number required.

size

target for number of successful trials, or dispersion parameter. Must be positive, need not be integer.

prob

parameter. 0 < prob <= 1.

p0

probability mass at zero. 0 <= p0 <= 1.

log, log.p

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

lower.tail

logical; if TRUE (default), probabilities are P[X \le x], otherwise, P[X > x].

Details

The zero-modified negative binomial distribution with size = r, prob = p and p0 = p_0 is a discrete mixture between a degenerate distribution at zero and a (standard) negative binomial. The probability mass function is p(0) = p_0 and

% p(x) = \frac{(1-p_0)}{(1-p^r)} f(x)

for x = 1, 2, \ldots, r \ge 0, 0 < p < 1 and 0 \le p_0 \le 1, where f(x) is the probability mass function of the negative binomial. The cumulative distribution function is

P(x) = p_0 + (1 - p_0) \left(\frac{F(x) - F(0)}{1 - F(0)}\right)

The mean is (1-p_0) \mu and the variance is (1-p_0) \sigma^2 + p_0(1-p_0) \mu^2, where \mu and \sigma^2 are the mean and variance of the zero-truncated negative binomial.

In the terminology of Klugman et al. (2012), the zero-modified negative binomial is a member of the (a, b, 1) class of distributions with a = 1-p and b = (r-1)(1-p).

The special case p0 == 0 is the zero-truncated negative binomial.

The limiting case size == 0 is the zero-modified logarithmic distribution with parameters 1 - prob and p0.

Unlike the standard negative binomial functions, parametrization through the mean mu is not supported to avoid ambiguity as to whether mu is the mean of the underlying negative binomial or the mean of the zero-modified distribution.

If an element of x is not integer, the result of dzmnbinom is zero, with a warning.

The quantile is defined as the smallest value x such that P(x) \ge p, where P is the distribution function.

Value

dzmnbinom gives the (log) probability mass function, pzmnbinom gives the (log) distribution function, qzmnbinom gives the quantile function, and rzmnbinom generates random deviates.

Invalid size, prob or p0 will result in return value NaN, with a warning.

The length of the result is determined by n for rzmnbinom, and is the maximum of the lengths of the numerical arguments for the other functions.

Note

Functions {d,p,q}zmnbinom use {d,p,q}nbinom for all but the trivial input values and p(0).

Author(s)

Vincent Goulet vincent.goulet@act.ulaval.ca

References

Klugman, S. A., Panjer, H. H. and Willmot, G. E. (2012), Loss Models, From Data to Decisions, Fourth Edition, Wiley.

See Also

dnbinom for the negative binomial distribution.

dztnbinom for the zero-truncated negative binomial distribution.

dzmgeom for the zero-modified geometric and dzmlogarithmic for the zero-modified logarithmic, which are special cases of the zero-modified negative binomial.

Examples

## Example 6.3 of Klugman et al. (2012)
p <- 1/(1 + 0.5)
dzmnbinom(1:5, size = 2.5, prob = p, p0 = 0.6)
(1-0.6) * dnbinom(1:5, 2.5, p)/pnbinom(0, 2.5, p, lower = FALSE) # same

## simple relation between survival functions
pzmnbinom(0:5, 2.5, p, p0 = 0.2, lower = FALSE)
(1-0.2) * pnbinom(0:5, 2.5, p, lower = FALSE) /
    pnbinom(0, 2.5, p, lower = FALSE) # same

qzmnbinom(pzmnbinom(0:10, 2.5, 0.3, p0 = 0.1), 2.5, 0.3, p0 = 0.1)

actuar documentation built on Nov. 8, 2023, 9:06 a.m.