AbstractIntegerDistribution
org.apache.commons.math3.distribution

Class AbstractIntegerDistribution

    • Method Detail

      • cumulativeProbability

        public double cumulativeProbability(int x0,                           int x1)                             throws NumberIsTooLargeException
        For a random variable X whose values are distributed according to this distribution, this method returns P(x0 < X <= x1). The default implementation uses the identity

        P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)

        Specified by:
        cumulativeProbability in interface IntegerDistribution
        Parameters:
        x0 - the exclusive lower bound
        x1 - the inclusive upper bound
        Returns:
        the probability that a random variable with this distribution will take a value between x0 and x1, excluding the lower and including the upper endpoint
        Throws:
        NumberIsTooLargeException - if x0 > x1
      • reseedRandomGenerator

        public void reseedRandomGenerator(long seed)
        Reseed the random generator used to generate samples.
        Specified by:
        reseedRandomGenerator in interface IntegerDistribution
        Parameters:
        seed - the new seed
      • sample

        public int sample()
        Generate a random value sampled from this distribution. The default implementation uses the inversion method.
        Specified by:
        sample in interface IntegerDistribution
        Returns:
        a random value
      • sample

        public int[] sample(int sampleSize)
        Generate a random sample from the distribution. The default implementation generates the sample by calling sample() in a loop.
        Specified by:
        sample in interface IntegerDistribution
        Parameters:
        sampleSize - the number of random values to generate
        Returns:
        an array representing the random sample
      • logProbability

        public double logProbability(int x)
        For a random variable X whose values are distributed according to this distribution, this method returns log(P(X = x)), where log is the natural logarithm. In other words, this method represents the logarithm of the probability mass function (PMF) for the distribution. Note that due to the floating point precision and under/overflow issues, this method will for some distributions be more precise and faster than computing the logarithm of IntegerDistribution.probability(int).

        The default implementation simply computes the logarithm of probability(x).

        Parameters:
        x - the point at which the PMF is evaluated
        Returns:
        the logarithm of the value of the probability mass function at x

SCaVis 2.0 © jWork.ORG