R: The Zero-Modified Binomial Distribution

ZeroModifiedBinomial {actuar} | R Documentation

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

### 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 ≤ x], otherwise, P[X > x].

### Details

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

p(x) = (1-p0)/[1 - (1-p)^n] f(x)

for x = 1, …, n, 0 < p ≤ 1 and 0 ≤ p0 ≤ 1, where f(x) is the probability mass function of the binomial. The cumulative distribution function is

P(x) = p0 + (1 - p0) [F(x) - F(0)]/[1 - F(0)].

The mean is (1-p0)m and the variance is (1-p0)v + p0(1-p0)m^2, where m and v 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) ≥ p, where P is the distribution function.

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

### Note

Functions `{d,p,q}zmbinom` use `{d,p,q}binom` 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

`dbinom` for the binomial distribution.

`dztbinom` for the zero-truncated binomial distribution.

### Examples

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

[Package actuar version 3.0-0 Index]