N
categories and shape parameters s
and b
.dzipfman(x, s, b, N, log = FALSE)
pzipfman(q, s, b, N, lower.tail = TRUE, log.p = FALSE)
qzipfman(p, s, b, N, lower.tail = TRUE, log.p = FALSE)
rzipfman(n, s, b, N)
length>1
, then the length is taken to be the number
required.TRUE
, then the probabilities are given as log(p)
.TRUE
, then probabilities are $P[X\le x]$, else $P[X>x]$.dzipfman
gives the density (mass), pzipfman
gives the distribution function, qzipfman
gives the quantile function, and rzipfman
generates random deviates.N
is the number of distinct categories. Note that the Zipf-Mandelbrot distribution is just a generalization of the Zipf distribution where the second shape parameter b=0
.runif
and .Random.seed
about random number generation.## Randomly generated data from the Zipf-Mandelbrot distribution.
set.seed(100)
x <- rzipfman(n = 500, 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)
Run the code above in your browser using DataLab