Description Usage Arguments Details Value See Also Examples
Density, distribution function, quantile function and random generation for the zero inflated binomial distribution with parameters (rho, size, prob).
1 2 3 4 5 6 7 |
x |
A non-negative integer-valued vector of quantiles. |
q |
A numeric vector of quantiles. |
p |
A vector of probabilities. |
n |
Number of random values to return, a length-one positive integer-valued vector. |
rho |
A length-one vector of zero inflation parameter on [0,1]. |
size |
A length-one vector of number of trials (zero or more). |
prob |
A length-one vector of probability of success on each trial. |
log, log.p |
A length-one logical vector; if TRUE, probabilities p are given as log(p). |
lower.tail |
A length-one logical vector; if TRUE (the default), probabilities are P(X ≤ x), otherwise, P(X > x). |
The probability mass function of X is given by
P(X=x) = rho I(x = 0) + (1 - rho) P(Y=x), x=0,1,2,...,
where Y is distributed binomial(size, prob).
dzibinom
gives the (log) density,
pzibinom
gives the (log) distribution function,
qzibinom
gives the quantile function,
and rzibinom
generates random deviates.
Invalid arguments rise an error.
Binomial for the binomial distribution.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # Example 1: dzibinom
dzibinom(x = 0:10, rho = 0.1, size = 5, prob = 0.5)
# Example 2: pzibinom
pzibinom(q = 2, rho = 0.1, size = 5, prob = 0.5)
# Example 3: qzibinom
qzibinom(p = pzibinom(2, 0.1, 5, 0.5), rho = 0.1, size = 5, prob = 0.5)
# Example 4: rzibinom
n <- 1e+5
rho <- 0.2
size <- 5
prob <- 0.5
mean(rzibinom(n, rho, size, prob)) # Sample mean
(size * prob) * (1 - rho) # Theoretical mean
|
[1] 0.128125 0.140625 0.281250 0.281250 0.140625 0.028125 0.000000 0.000000
[9] 0.000000 0.000000 0.000000
[1] 0.55
[1] 2
[1] 2.00435
[1] 2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.