

   DDiissccrreettee DDiissttrriibbuuttiioonn

        ddiscrete(x, probs, values=1:length(probs))
        pdiscrete(q, probs, values=1:length(probs))
        qdiscrete(p, probs, values=1:length(probs))
        rdiscrete(n, probs, values=1:length(probs), method="inverse", aliasmatrix=NULL)

   AArrgguummeennttss::

        x,q: vector or array of quantiles.

          p: vector or array of probabilites.

          n: number of observations.

      probs: probabilities of the distribution.

     values: values of the distribution.

     method: generation method, can be "inverse" or "alias"

   aliasmatrix: matrix needed by alias method

   DDeessccrriippttiioonn::

        These functions provide information about the discrete
        distribution where the probability of the elements of
        `values' is proportional to the values given in
        `probs', which are normalized tp sum up to 1. `ddis-
        crete' gives the density, `pdiscrete' gives the distri-
        bution function, `qdiscrete' gives the quantile func-
        tion and `rdiscrete' generates random deviates.

        For the generation of the random deviates, one can
        choose between the method "inverse" which basically
        makes a lookup in the vector of the probabilities and
        the method "alias". The later method computes an alias-
        matrix by the function `aliasmat' which allows a faster
        data generation once this matrix is computed. If such a
        matrix has already been computed, it can be passed as
        further argument to `rdiscrete'.

   AAuutthhoorr((ss))::

        Andreas Weingessel and Friedrich Leisch

   EExxaammpplleess::

        # a vector of length 30 whose elements are 1 with probability 0.2 and 2
        # with probability 0.8.
        rdiscrete (30, c(0.2, 0.8))

        # a vector of length 100 whose elements are A, B, C, D.
        # The probabilities of the four values have the relation 1:2:3:3
        rdiscrete (100, c(1,2,3,3), c("A","B","C","D"))

