Class EnumeratedRealDistribution

  • All Implemented Interfaces:
    java.io.Serializable, ContinuousDistribution

    public class EnumeratedRealDistribution
    extends java.lang.Object
    implements ContinuousDistribution, java.io.Serializable

    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
    See Also:
    Serialized Form
    • Method Detail

      • probability

        public double probability​(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:
        probability in interface ContinuousDistribution
        Parameters:
        x - Point at which the PMF is evaluated.
        Returns:
        the value of the probability mass function at point x.
      • 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 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)
        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 (cumulative) distribution function (CDF) for this distribution.
        Specified by:
        cumulativeProbability in interface ContinuousDistribution
        Parameters:
        x - Point at which the CDF is evaluated.
        Returns:
        the probability that a random variable with this distribution takes a value less than or equal to x.
      • inverseCumulativeProbability

        public double inverseCumulativeProbability​(double p)
                                            throws OutOfRangeException
        Computes the quantile function of this distribution. For a random variable X distributed according to this distribution, the returned value is
        • inf{x in R | P(X<=x) >= p} for 0 < p <= 1,
        • inf{x in R | P(X<=x) > 0} for p = 0.
        Specified by:
        inverseCumulativeProbability in interface ContinuousDistribution
        Parameters:
        p - Cumulative probability.
        Returns:
        the smallest p-quantile of this distribution (largest 0-quantile for p = 0).
        Throws:
        OutOfRangeException
      • getMean

        public double getMean()
        Gets the mean of this distribution.
        Specified by:
        getMean in interface ContinuousDistribution
        Returns:
        sum(singletons[i] * probabilities[i])
      • getVariance

        public double getVariance()
        Gets the variance of this distribution.
        Specified by:
        getVariance in interface ContinuousDistribution
        Returns:
        sum((singletons[i] - mean) ^ 2 * probabilities[i])
      • getSupportLowerBound

        public double getSupportLowerBound()
        Gets the lower bound of the support. It must return the same value as inverseCumulativeProbability(0), i.e. inf {x in R | P(X <= x) > 0}. Returns the lowest value with non-zero probability.
        Specified by:
        getSupportLowerBound in interface ContinuousDistribution
        Returns:
        the lowest value with non-zero probability.
      • getSupportUpperBound

        public double getSupportUpperBound()
        Gets the upper bound of the support. It must return the same value as inverseCumulativeProbability(1), i.e. inf {x in R | P(X <= x) = 1}. Returns the highest value with non-zero probability.
        Specified by:
        getSupportUpperBound in interface ContinuousDistribution
        Returns:
        the highest value with non-zero probability.
      • isSupportConnected

        public boolean isSupportConnected()
        Indicates whether the support is connected, i.e. whether all values between the lower and upper bound of the support are included in the support. The support of this distribution is connected.
        Specified by:
        isSupportConnected in interface ContinuousDistribution
        Returns:
        true