Density, distribution function, quantile function and random generation for the Mandelbrot distribution.
dzipfmb(x, shape, start = 1, log = FALSE)
pzipfmb(q, shape, start = 1, lower.tail = TRUE, log.p = FALSE)
qzipfmb(p, shape, start = 1)
rzipfmb(n, shape, start = 1)
vector of (non-negative integer) quantiles.
vector of quantiles.
vector of probabilities.
number of random values to return.
vector of positive shape parameter.
integer, the minimum value of the support of the distribution.
logical; if TRUE, probabilities p are given as log(p)
logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x].
dzipfmb
gives the density,
pzipfmb
gives the distribution function,
qzipfmb
gives the quantile function, and
rzipfmb
generates random deviates.
The probability mass function of the zipf-mandelbrot distribution is given by
Mandelbrot, B. (1961). On the theory of word frequencies and on related Markovian models of discourse. In R. Jakobson, Structure of Language and its Mathematical Aspects, pp. 190--219, Providence, RI, USA. American Mathematical Society.
Moreno-Sanchez, I. and Font-Clos, F. and Corral, A. (2016). Large-Scale Analysis of Zipf's Law in English Texts. PLos ONE, 11(1), 1--19.
Zipf
.
# NOT RUN {
aa <- 1:10
(pp <- pzipfmb(aa, shape = 0.5, start = 1))
cumsum(dzipfmb(aa, shape = 0.5, start = 1)) # Should be same
qzipfmb(pp, shape = 0.5, start = 1) - aa # Should be all 0s
rdiffzeta(30, 0.5)
# }
# NOT RUN {
x <- 1:10
plot(x, dzipfmb(x, shape = 0.5), type = "h", ylim = 0:1,
sub = "shape=0.5", las = 1, col = "blue", ylab = "Probability",
main = "Zipf-Mandelbrot distribution: blue=PMF; orange=CDF")
lines(x + 0.1, pzipfmb(x, shape = 0.8), col = "orange", lty = 3, type = "h")
# }
Run the code above in your browser using DataLab