Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ZINB

Zero-inflated negative binomial distribution


Description

Probability mass function and random generation for the zero-inflated negative binomial distribution.

Usage

dzinb(x, size, prob, pi, log = FALSE)

pzinb(q, size, prob, pi, lower.tail = TRUE, log.p = FALSE)

qzinb(p, size, prob, pi, lower.tail = TRUE, log.p = FALSE)

rzinb(n, size, prob, pi)

Arguments

x, q

vector of quantiles.

size

target for number of successful trials, or dispersion parameter (the shape parameter of the gamma mixing distribution). Must be strictly positive, need not be integer.

prob

probability of success in each trial. 0 < prob <= 1.

pi

probability of extra zeros.

log, log.p

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

lower.tail

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

p

vector of probabilities.

n

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

Details

Probability density function

f(x) = [if x = 0:] (1-π)+π * p^r [else:] (1-π) * dnbinom(x, size, prob)

See Also

Examples

x <- rzinb(1e5, 100, 0.6, 0.33)
xx <- -2:200
plot(prop.table(table(x)), type = "h")
lines(xx, dzinb(xx, 100, 0.6, 0.33), col = "red")

xx <- seq(0, 200, by = 0.01)
plot(ecdf(x))
lines(xx, pzinb(xx, 100, 0.6, 0.33), col = "red")

extraDistr

Additional Univariate and Multivariate Distributions

v1.9.1
GPL-2
Authors
Tymoteusz Wolodzko
Initial release
2020-08-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.