Class DistNegBinomial

    • Constructor Detail

      • DistNegBinomial

        public DistNegBinomial​(StreamInterface stream,
                               int s,
                               double p)
        constructs a new negative binomial distribution.
        Parameters:
        stream - StreamInterface; the random number stream
        s - int; the number of successes in the sequence of (x+n) trials, where trial (x+n) is a success
        p - double; the probability of success for each individual trial in the negative binomial distribution
        Throws:
        IllegalArgumentException - when s <= 0 or p <= 0 or p >= 1
    • Method Detail

      • draw

        public long draw()
        draws the next long from the stream.
        Specified by:
        draw in class DistDiscrete
        Returns:
        long
      • probability

        public double probability​(long observation)
        returns the probability of the observation in this particular distribution.
        Specified by:
        probability in class DistDiscrete
        Parameters:
        observation - long; the discrete observation.
        Returns:
        double the probability.
      • getS

        public int getS()
        Return the number of successes in the sequence of (x+n) trials, where trial (x+n) is a success.
        Returns:
        int; the number of successes in the sequence of (x+n) trials, where trial (x+n) is a success
      • getP

        public double getP()
        Return the probability of success for each individual trial in the negative binomial distribution.
        Returns:
        double; the probability of success for each individual trial in the negative binomial distribution