ZipfMandelbrot {tolerance} | R Documentation |
Zipf-Mandelbrot Distributions
Description
Density (mass), distribution function, quantile function, and random generation for the Zipf, Zipf-Mandelbrot, and zeta distributions.
Usage
dzipfman(x, s, b = NULL, N = NULL, log = FALSE)
pzipfman(q, s, b = NULL, N = NULL, lower.tail = TRUE,
log.p = FALSE)
qzipfman(p, s, b = NULL, N = NULL, lower.tail = TRUE,
log.p = FALSE)
rzipfman(n, s, b = NULL, N = NULL)
Arguments
x , q |
Vector of quantiles. |
p |
Vector of probabilities. |
n |
The number of observations. If |
s , b |
The shape parameters, both of which must be greater than 0. |
N |
The number of categories, which must be integer-valued for Zipf and Zipf-Mandelbrot distributions. For a zeta distribution, |
log , log.p |
Logical vectors. If |
lower.tail |
Logical vector. If |
Details
The Zipf-Mandelbrot distribution has mass
p(x) = \frac{(x + b)^{-s}}{\sum_{i=1}^{N}(i + b)^{-s}},
where x=1,\ldots,N
, s,b>0
are shape parameters, and N
is the number of distinct categories. The Zipf distribution is just a special case of the Zipf-Mandelbrot distribution where the second shape parameter b=0
. The zeta distribution has mass
p(x) = \frac{x^{-s}}{\zeta(s)},
where x=1,2,\ldots
, s>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 the Zipf distribution where s>1
and N
goes to infinity.
Value
dzipfman
gives the density (mass), pzipfman
gives the distribution function, qzipfman
gives the quantile function, and rzipfman
generates random deviates for the specified distribution.
Note
These functions may be updated in a future version of the package so as to allow greater flexibility with the inputs.
References
Mandelbrot, B. B. (1965), Information Theory and Psycholinguistics. In B. B. Wolman and E. Nagel, editors. Scientific Psychology, Basic Books.
Young, D. S. (2013), Approximate Tolerance Limits for Zipf-Mandelbrot Distributions, Physica A: Statistical Mechanics and its Applications, 392, 1702–1711.
Zipf, G. K. (1949), Human Behavior and the Principle of Least Effort, Hafner.
Zornig, 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
## Randomly generated data from the Zipf distribution.
set.seed(100)
x <- rzipfman(n = 150, s = 2, N = 100)
hist(x, main = "Randomly Generated Data", prob = TRUE)
x.1 <- sort(x)
y <- dzipfman(x = x.1, s = 2, N = 100)
lines(x.1, y, col = 2, lwd = 2)
plot(x.1, pzipfman(q = x.1, s = 2, N = 100), type = "l",
xlab = "x", ylab = "Cumulative Probabilities")
qzipfman(p = 0.20, s = 2, N = 100, lower.tail = FALSE)
qzipfman(p = 0.80, s = 2, N = 100)
## Randomly generated data from the Zipf-Mandelbrot distribution.
set.seed(100)
x <- rzipfman(n = 150, s = 2, b = 3, N = 100)
hist(x, main = "Randomly Generated Data", prob = TRUE)
x.1 <- sort(x)
y <- dzipfman(x = x.1, s = 2, b = 3, N = 100)
lines(x.1, y, col = 2, lwd = 2)
plot(x.1, pzipfman(q = x.1, s = 2, b = 3, N = 100), type = "l",
xlab = "x", ylab = "Cumulative Probabilities")
qzipfman(p = 0.20, s = 2, b = 3, N = 100, lower.tail = FALSE)
qzipfman(p = 0.80, s = 2, b = 3, N = 100)
## Randomly generated data from the zeta distribution.
set.seed(100)
x <- rzipfman(n = 100, s = 1.3, N = Inf)
hist(x, main = "Randomly Generated Data", prob = TRUE)
x.1 <- sort(x)
y <- dzipfman(x = x.1, s = 1.3, N = Inf)
lines(x.1, y, col = 2, lwd = 2)
plot(x.1, pzipfman(q = x.1, s = 1.3, N = Inf), type = "l",
xlab = "x", ylab = "Cumulative Probabilities")
qzipfman(p = 0.20, s = 1.3, lower.tail = FALSE, N = Inf)
qzipfman(p = 0.80, s = 1.3, N = Inf)