Learn R Programming

tolerance (version 0.4.0)

Zeta: The Zeta Distribution

Description

Density (mass), distribution function, quantile function and random generation for the zeta distribution with parameter s.

Usage

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

Arguments

x, q
Vector of quantiles.
p
Vector of probabilities.
n
The number of observations. If length>1, then the length is taken to be the number required.
s
The shape parameter, which must be strictly greater than 1.
log, log.p
Logical vectors. If TRUE, then the probabilities are given as log(p).
lower.tail
Logical vector. If TRUE, then probabilities are $P[X\le x]$, else $P[X>x]$.

Value

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

Details

The zeta distribution has mass $$p(x) = \frac{x^{-\lambda}}{\zeta(\lambda)},$$ where $x=1,2,\ldots$, $\lambda>1$ is the shape parameter, and $\zeta()$ is the Riemann zeta function given by: $$\zeta(t) = \sum_{i=1}^{\infty}\frac{1}{i^{t}}<\infty.$$ note="" that="" the="" zeta="" distribution="" is="" just="" a="" special="" case="" of="" zipf="" where="" s>1 and N goes to infinity.

References

Zipf, G. K. (1949), Human Behavior and the Principle of Least Effort, Hafner.\ Z"{o}rnig, P. and Altmann, G. (1995), Unified Representation of Zipf Distributions, Computational Statistics and Data Analysis, 19, 461--473.

See Also

runif and .Random.seed about random number generation.

Examples

Run this code
## Randomly generated data from the zeta distribution.

set.seed(100)
x <- rzeta(n = 100, s = 1.3)
hist(x, main = "Randomly Generated Data", prob = TRUE)

x.1 <- sort(x)
y <- dzeta(x = x.1, s = 1.3)
lines(x.1, y, col = 2, lwd = 2)

plot(x.1, pzeta(q = x.1, s = 1.3), type = "l", 
     xlab = "x", ylab = "Cumulative Probabilities")

qzeta(p = 0.20, s = 1.3, lower.tail = FALSE)
qzeta(p = 0.80, s = 1.3)

Run the code above in your browser using DataLab