Oizeta {VGAMdata} | R Documentation |
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 |
shape |
Vector of positive shape parameters. |
pstr1 |
Probability of a structural one
(i.e., ignoring the zeta distribution),
called |
log |
Same as |
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.
Value
doizeta
gives the density,
poizeta
gives the distribution function,
qoizeta
gives the quantile function, and
roizeta
generates random deviates.
Note
The argument pstr1
is recycled to the required length,
and usually has values which lie in the interval [0,1]
.
These functions actually allow for the zero-deflated
zeta distribution. Here, pstr1
is also permitted
to lie in the interval
[-dzeta(1, shape) / (1 - dzeta(1, shape)), 0]
.
The resulting probability of a unit count is less than
the nominal zeta value, and the use of pstr1
to
stand for the probability of a structural 1 loses its
meaning.
When pstr1
equals
-dzeta(1, shape) / (1 - dzeta(1, shape))
this corresponds to the 1-truncated zeta distribution.
Author(s)
T. W. Yee
See Also
Examples
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 = paste0("OIZeta(", shape, ", pstr1 = ", pstr1,
") (blue) vs Zeta(", shape, ") (orange)"),
names.arg = as.character(x))
deflat.limit <- -dzeta(1, shape) / pzeta(1, shape, lower.tail = FALSE)
newpstr1 <- round(deflat.limit, 3) + 0.001 # Near the boundary
barplot(rbind(doizeta(x, shape, pstr1 = newpstr1),
dzeta(x, shape)),
beside = TRUE, col = c("blue","orange"),
main = paste0("ODZeta(", shape, ", pstr1 = ", newpstr1,
") (blue) vs Zeta(", shape, ") (orange)"),
names.arg = as.character(x))
## End(Not run)