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
using ur
.
It also allows to compute quantiles by means of uq
.
Vector 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
from:(from+length(pv)-1)
.
Alternatively, one can use function dgtd.new
where the object
distr
of class "unuran.discr"
must contain all required
information about the distribution.