Learn R Programming

actuar (version 3.3-4)

ZeroModifiedBinomial: The Zero-Modified Binomial Distribution

Description

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

Usage

dzmbinom(x, size, prob, p0, log = FALSE)
pzmbinom(q, size, prob, p0, lower.tail = TRUE, log.p = FALSE)
qzmbinom(p, size, prob, p0, lower.tail = TRUE, log.p = FALSE)
rzmbinom(n, size, prob, p0)

Value

dzmbinom gives the probability mass function,

pzmbinom gives the distribution function,

qzmbinom gives the quantile function, and

rzmbinom 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

rzmbinom, and is the maximum of the lengths of the numerical arguments for the other functions.

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

number of trials (strictly positive integer).

prob

probability of success on each trial. 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]\).

Author

Vincent Goulet vincent.goulet@act.ulaval.ca

Details

The zero-modified binomial distribution with size \(= n\), prob \(= p\) and p0 \(= p_0\) is a discrete mixture between a degenerate distribution at zero and a (standard) binomial. The probability mass function is \(p(0) = p_0\) and $$% p(x) = \frac{(1-p_0)}{(1 - (1-p)^n)} f(x)$$ for \(x = 1, \ldots, n\), \(0 < p \le 1\) and \(0 \le p_0 \le 1\), where \(f(x)\) is the probability mass function of the 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 binomial.

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

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

If an element of x is not integer, the result of dzmbinom 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.

References

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

See Also

dbinom for the binomial distribution.

dztbinom for the zero-truncated binomial distribution.

Examples

Run this code
dzmbinom(1:5, size = 5, prob = 0.4, p0 = 0.2)
(1-0.2) * dbinom(1:5, 5, 0.4)/pbinom(0, 5, 0.4, lower = FALSE) # same

## simple relation between survival functions
pzmbinom(0:5, 5, 0.4, p0 = 0.2, lower = FALSE)
(1-0.2) * pbinom(0:5, 5, 0.4, lower = FALSE) /
    pbinom(0, 5, 0.4, lower = FALSE) # same

qzmbinom(pzmbinom(1:10, 10, 0.6, p0 = 0.1), 10, 0.6, p0 = 0.1)

n <- 8; p <- 0.3; p0 <- 0.025
x <- 0:n
title <- paste("ZM Binomial(", n, ", ", p, ", p0 = ", p0,
               ") and Binomial(", n, ", ", p,") PDF",
               sep = "")
plot(x, dzmbinom(x, n, p, p0), type = "h", lwd = 2, ylab = "p(x)",
     main = title)
points(x, dbinom(x, n, p), pch = 19, col = "red")
legend("topright", c("ZT binomial probabilities", "Binomial probabilities"),
       col = c("black", "red"), lty = c(1, 0), lwd = 2, pch = c(NA, 19))

Run the code above in your browser using DataLab