Density, distribution function and random number
generation for the discrete power law distribution with
parameters xmin and alpha.
Usage
dpldis(x, xmin, alpha, log = FALSE)
ppldis(q, xmin, alpha, lower.tail = TRUE)
rpldis(n, xmin, alpha, discrete_max = 1e+05)
Arguments
Value
dpldis returns the denisty, ppldis returns the
distribution function and rpldis return random numbers.
Details
The Clausett, 2009 paper provides an algorithm for
generating discrete random numbers. However, if this
algorithm is implemented in R, it gives terrible
performance. This is because the algorithm involves
"growing vectors". Another problem is when alpha is close
to 1, this can result in very large random number being
generated (which means we need to calculate the discrete
CDF).
The algorithm provided in this package generates true
discrete random numbers up to 1e5 then switches to using
continuous random numbers. This switching point can
altered by changing the discrete_max argument.
In order to get a efficient power-law discrete random
number generator, the algorithm needs to be implemented
in C.