Learn R Programming

VGAM (version 1.0-5)

Oizeta: One-Inflated Zeta Distribution

Description

Density, distribution function, quantile function and random generation for the one-inflated zeta distribution with parameter pstr1.

Usage

doizeta(x, shape, pstr1 = 0, log = FALSE)
poizeta(q, shape, pstr1 = 0)
qoizeta(p, shape, pstr1 = 0)
roizeta(n, shape, pstr1 = 0)

Arguments

x, q, p, n

Same as Uniform.

shape

Vector of positive shape parameters.

pstr1

Probability of a structural one (i.e., ignoring the zeta distribution), called \(\phi\). The default value of \(\phi = 0\) corresponds to the response having an ordinary zeta distribution.

log

Same as Uniform.

Value

doizeta gives the density, poizeta gives the distribution function, qoizeta gives the quantile function, and roizeta generates random deviates.

Details

The probability function of \(Y\) is 1 with probability \(\phi\), and \(Zeta(shape)\) with probability \(1-\phi\). Thus $$P(Y=1) =\phi + (1-\phi) P(W=1)$$ where \(W\) is distributed as a \(zeta(shape)\) random variable.

See Also

Zeta, zetaff. Otzeta,

Examples

Run this code
# NOT RUN {
shape <- 1.5; pstr1 <- 0.3; x <- (-1):7
(ii <- doizeta(x, shape, pstr1 = pstr1))
max(abs(poizeta(1:200, shape) -
        cumsum(1/(1:200)^(1+shape)) / zeta(shape+1)))  # Should be 0

# }
# NOT RUN {
 x <- 0:10
par(mfrow = c(2, 1))  # One-Inflated zeta
barplot(rbind(doizeta(x, shape, pstr1 = pstr1), dzeta(x, shape)),
        beside = TRUE, col = c("blue", "orange"),
        main = paste("OIZeta(", shape, ", pstr1 = ", pstr1, ") (blue) vs",
                     " Zeta(", shape, ") (orange)", sep = ""),
        names.arg = as.character(x))

deflat.limit <- -dzeta(1, shape) / pzeta(1, shape, lower.tail = FALSE)
newpstr1 <- round(deflat.limit, 3) + 0.001  # Inside but near the boundary
barplot(rbind(doizeta(x, shape, pstr1 = newpstr1),
                dzeta(x, shape)),
        beside = TRUE, col = c("blue","orange"),
        main = paste("ODZeta(", shape, ", pstr1 = ", newpstr1, ") (blue) vs",
                     " Zeta(", shape, ") (orange)", sep = ""),
        names.arg = as.character(x)) 
# }

Run the code above in your browser using DataLab