Density, distribution function, quantile function and random generation
for the one-inflated
zeta distribution with parameter pstr1
.
doizeta(x, shape, pstr1 = 0, log = FALSE)
poizeta(q, shape, pstr1 = 0)
qoizeta(p, shape, pstr1 = 0)
roizeta(n, shape, pstr1 = 0)
Same as Uniform
.
Vector of positive shape parameters.
Probability of a structural one
(i.e., ignoring the zeta distribution),
called
Same as Uniform
.
doizeta
gives the density,
poizeta
gives the distribution function,
qoizeta
gives the quantile function, and
roizeta
generates random deviates.
The probability function of
# 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