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
if (FALSE) 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))
Run the code above in your browser using DataLab