UNU.RAN random variate generator for discrete distributions with given probability vector. It applies the Guide-Table Method for discrete inversion (‘DGT’).
[Universal] – Inversion Method.
vector of non-negative numbers (need not sum to 1). (numeric vector)
index of first entry in vector. (integer)
distribution object. (S4 object of class
This function creates an
unuran object based on ‘DGT’
(Discrete Guide-Table method). It can be used to draw samples of a
discrete random variate with given probability vector
It also allows to compute quantiles by means of
pv must be postive but need not be normalized
(i.e., it can be any multiple of a probability vector).
The method runs fast in constant time, i.e., marginal sampling times do not depend on the length of the given probability vector. Whereas their setup times grow linearly with this length.
Notice that the range of random variates is
Alternatively, one can use function
dgtd.new where the object
distr of class
"unuran.discr" must contain all required
information about the distribution.
An object of class
Josef Leydold and Wolfgang H\"ormann [email protected].
W. H\"ormann, J. Leydold, and G. Derflinger (2004): Automatic Nonuniform Random Variate Generation. Springer-Verlag, Berlin Heidelberg. See Section 3.1.2 (Indexed Search).
H.C. Chen and Y. Asau (1974): On generating random variates from an empirical distribution. AIIE Trans. 6, pp.163–166.
1 2 3 4 5 6 7 8 9
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.