zoabetaUC: The Zero/One-Inflated Beta Distribution

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Density, distribution function, and random generation for the zero/one-inflated beta distribution.

Usage

1
2
3
4
5
6
7
8
dzoabeta(x, shape1, shape2, pobs0 = 0, pobs1 = 0, log = FALSE,
         tol = .Machine$double.eps)
pzoabeta(q, shape1, shape2, pobs0 = 0, pobs1 = 0,
         lower.tail = TRUE, log.p = FALSE, tol = .Machine$double.eps)
qzoabeta(p, shape1, shape2, pobs0 = 0, pobs1 = 0,
         lower.tail = TRUE, log.p = FALSE, tol = .Machine$double.eps)
rzoabeta(n, shape1, shape2, pobs0 = 0, pobs1 = 0,
         tol = .Machine$double.eps)

Arguments

x, q, p, n

Same as Beta.

pobs0, pobs1

vector of probabilities that 0 and 1 are observed (omega_0 and omega_1).

shape1, shape2

Same as Beta. They are called a and b in beta respectively.

lower.tail, log, log.p

Same as Beta.

tol

Numeric, tolerance for testing equality with 0 and 1.

Details

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.

Value

dzoabeta gives the density, pzoabeta gives the distribution function, qzoabeta gives the quantile, and rzoabeta generates random deviates.

Author(s)

Xiangjie Xue and T. W. Yee

See Also

zoabetaR, beta, betaR, Betabinom.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
N <- 1000; y <- rzoabeta(N, 2, 3, 0.2, 0.2)
hist(y, probability = TRUE, border = "blue", las = 1,
     main = "Blue = 0- and 1-altered; orange = ordinary beta")
sum(y == 0) / N  # Proportion of 0s
sum(y == 1) / N  # Proportion of 1s
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",
      dzoabeta(seq(0, 1, length = Ngrid), 2 , 3, 0.2, 0.2))

## End(Not run)

Example output

Loading required package: stats4
Loading required package: splines
[1] 0.186
[1] 0.205

VGAM documentation built on Jan. 16, 2021, 5:21 p.m.