Class EnumeratedRealDistribution

  • All Implemented Interfaces:
    org.apache.commons.statistics.distribution.ContinuousDistribution

    public class EnumeratedRealDistribution
    extends Object
    implements org.apache.commons.statistics.distribution.ContinuousDistribution

    Implementation of a real-valued EnumeratedDistribution.

    Values with zero-probability are allowed but they do not extend the support.
    Duplicate values are allowed. Probabilities of duplicate values are combined when computing cumulative probabilities and statistics.

    Since:
    3.2
    • Method Detail

      • density

        public double density​(double x)
        For a random variable X whose values are distributed according to this distribution, this method returns P(X = x). In other words, this method represents the probability mass function (PMF) for the distribution.
        Specified by:
        density in interface org.apache.commons.statistics.distribution.ContinuousDistribution
        Parameters:
        x - the point at which the PMF is evaluated
        Returns:
        the value of the probability mass function at point x
      • cumulativeProbability

        public double cumulativeProbability​(double x)
        Specified by:
        cumulativeProbability in interface org.apache.commons.statistics.distribution.ContinuousDistribution
      • getMean

        public double getMean()
        Specified by:
        getMean in interface org.apache.commons.statistics.distribution.ContinuousDistribution
        Returns:
        sum(singletons[i] * probabilities[i])
      • getVariance

        public double getVariance()
        Specified by:
        getVariance in interface org.apache.commons.statistics.distribution.ContinuousDistribution
        Returns:
        sum((singletons[i] - mean) ^ 2 * probabilities[i])
      • getSupportLowerBound

        public double getSupportLowerBound()
        Returns the lowest value with non-zero probability.
        Specified by:
        getSupportLowerBound in interface org.apache.commons.statistics.distribution.ContinuousDistribution
        Returns:
        the lowest value with non-zero probability.
      • getSupportUpperBound

        public double getSupportUpperBound()
        Returns the highest value with non-zero probability.
        Specified by:
        getSupportUpperBound in interface org.apache.commons.statistics.distribution.ContinuousDistribution
        Returns:
        the highest value with non-zero probability.
      • createSampler

        public org.apache.commons.statistics.distribution.ContinuousDistribution.Sampler createSampler​(org.apache.commons.rng.UniformRandomProvider rng)
        Specified by:
        createSampler in interface org.apache.commons.statistics.distribution.ContinuousDistribution