Density, distribution function, quantile function and random generation for the zeta distribution.

dzeta(x, shape, log = FALSE)
pzeta(q, shape, lower.tail = TRUE)
qzeta(p, shape)
rzeta(n, shape)

Arguments

x, q, p, n

Same as Poisson.

shape

The positive shape parameter \(s\).

lower.tail, log

Same meaning as in Normal.

Details

The density function of the zeta distribution is given by $$y^{-s-1} / \zeta(s+1)$$ where \(s>0\), \(y=1,2,\ldots\), and \(\zeta\) is Riemann's zeta function.

Value

dzeta gives the density, pzeta gives the distribution function, qzeta gives the quantile function, and rzeta generates random deviates.

References

Johnson N. L., Kotz S., and Balakrishnan N. (1993). Univariate Discrete Distributions, 2nd ed. New York: Wiley.

Author

T. W. Yee

Note

qzeta() runs slower and slower as shape approaches 0 and shape approaches 1. The VGAM family function zetaff estimates the shape parameter \(s\).

See also

zeta, zetaff, Oazeta, Oizeta, Otzeta.

Examples

dzeta(1:20, shape = 2)
#>  [1] 0.8319073726 0.1039884216 0.0308113842 0.0129985527 0.0066552590
#>  [6] 0.0038514230 0.0024253859 0.0016248191 0.0011411624 0.0008319074
#> [11] 0.0006250243 0.0004814279 0.0003786561 0.0003031732 0.0002464911
#> [16] 0.0002031024 0.0001693278 0.0001426453 0.0001212870 0.0001039884
myshape <- 0.5
max(abs(pzeta(1:200, myshape) -
    cumsum(1/(1:200)^(1+myshape)) / zeta(myshape+1)))  # Should be 0
#> [1] 2.220446e-16

if (FALSE)  plot(1:6, dzeta(1:6, 2), type = "h", las = 1,
               col = "orange", ylab = "Probability",
 main = "zeta probability function; orange: shape = 2; blue: shape = 1")
points(0.10 + 1:6, dzeta(1:6, 1), type = "h", col = "blue")  # \dontrun{}
#> Error in plot.xy(xy.coords(x, y), type = type, ...): plot.new has not been called yet