Ozibeta {VGAM} | R Documentation |
Density, distribution function, and random generation for the zero/one-inflated beta distribution.
dozibeta(x, shape1, shape2, pobs0 = 0, pobs1 = 0, log = FALSE, tol = .Machine$double.eps) pozibeta(q, shape1, shape2, pobs0 = 0, pobs1 = 0, lower.tail = TRUE, log.p = FALSE, tol = .Machine$double.eps) qozibeta(p, shape1, shape2, pobs0 = 0, pobs1 = 0, lower.tail = TRUE, log.p = FALSE, tol = .Machine$double.eps) rozibeta(n, shape1, shape2, pobs0 = 0, pobs1 = 0, tol = .Machine$double.eps)
x, q, p, n |
Same as |
pobs0 |
vector of probabilities that 0 are observed (omega_0). |
pobs1 |
vector of probabilities that 1 are observed (omega_1). |
shape1, shape2 |
|
lower.tail, log, log.p |
Same as |
tol |
Numeric, tolerance for testing equality with 0. |
This distribution is a mixture of a discrete distribution with a continuous distribution. The cumulative distribution function of Y is
F(y) =(1 - omega_0 - omega_1) B(y) + omega_0 * I[0 <= y] + omega_1 * I[1 <= y]
where B(y) is the cumulative distribution function
of the beta distribution with the same shape parameters
(pbeta
),
omega_0 is the inflated probability at 0
and omega_1 is the inflated probability at 1.
The default values of omega_j mean that these
functions behave like the ordinary Beta
when only the essential arguments are inputted.
dozibeta
gives the density,
pozibeta
gives the distribution function,
qozibeta
gives the quantile, and
rozibeta
generates random deviates.
Xiangjie Xue and T. W. Yee
## Not run: set.seed(208); N <- 10000 k <- rozibeta(N, 2, 3, 0.2, 0.2) hist(k, probability = TRUE, border = "blue", main = "Blue = inflated; orange = ordinary beta") sum(k == 0) / N # Proportion of 0 sum(k == 1) / N # Proportion of 1 Ngrid <- 1000 lines(seq(0, 1, length = Ngrid), dbeta(seq(0, 1, length = Ngrid), 2, 3), col = "orange") lines(seq(0, 1, length = Ngrid), col = "blue", dozibeta(seq(0, 1, length = Ngrid), 2 , 3, 0.2, 0.2)) set.seed(1234); k <- runif(1000) sum(abs(qozibeta(k, 2, 3) - qbeta(k, 2, 3)) > .Machine$double.eps) # Should be 0 sum(abs(pozibeta(k, 10, 7) - pbeta(k, 10, 7)) > .Machine$double.eps) # Should be 0 ## End(Not run)