Interface IProbabilityMassFunction

  • All Superinterfaces:
    IProbabilityFunction
    All Known Implementing Classes:
    ProbabilityMassFunctionImpl

    public interface IProbabilityMassFunction
    extends IProbabilityFunction
    A probability mass function (abbreviated pmf) gives the probability that a discrete random variable is exactly equal to some value. A probability mass function differs from a probability density function in that the values of the latter, defined only for continuous random variables, are not probabilities; rather, its integral over a set of possible values of the random variable is a probability. Note that the operations defined here are not suitable to add and multiply random numbers in general (e.g. in the DependencySolver). They are defined per-value and are required for internal computations (e.g. Fourier Transformation).
    • Method Detail

      • drawSample

        Object drawSample()
        Generates a random number of the probability function's domain, whose distribution is defined by the probability function.
        Returns:
        A sample of the PMF's domain.
      • add

        IProbabilityMassFunction add​(IProbabilityMassFunction pmf)
                              throws DifferentDomainsException
        Adds the probabilities of two probability mass functions (pmf) on a 'per value' basis.
        h(x) = f(x) + g(x) (f = this, g = parameter pmf)
        For the addition, the domains of both pmfs have to be equal. This means that
      • * the value objects of the pmf's samples have to be of the same class and
      • * for each value object of the samples in function f (this) there is exactly one equal value object in the samples of function g (pmf) and vice versa. Here, equal means that Object.equal(...) returns true for both objects.

      • If the domain of both functions are not equal, a DifferentDomainsException is thrown.
Parameters:
pmf - Function to add.
Returns:
A new pmf that contains the sum of both.
Throws:
DifferentDomainsException - if the domains of both function differ.
Parameters:
pmf - Function to substract.
Returns:
A new pmf that contains the difference of both.
Throws:
DifferentDomainsException - if the domains of both function differ.