ZIB: Zero-inflated binomial distribution

Description Usage Arguments Details See Also Examples

Description

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

Usage

1
2
3
4
5
6
7
dzib(x, size, prob, pi, log = FALSE)

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

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

rzib(n, size, prob, pi)

Arguments

x, q

vector of quantiles.

size

number of trials (zero or more).

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

Binomial

Examples

1
2
3
4
5
6
7
8
x <- rzib(1e5, 10, 0.6, 0.33)
xx <- -2:20
plot(prop.table(table(x)), type = "h")
lines(xx, dzib(xx, 10, 0.6, 0.33), col = "red")

xx <- seq(0, 20, by = 0.01)
plot(ecdf(x))
lines(xx, pzib(xx, 10, 0.6, 0.33), col = "red")

extraDistr documentation built on Sept. 7, 2020, 5:09 p.m.

Related to ZIB in extraDistr...