Class ProbDistribution

java.lang.Object
org.bzdev.math.stats.ProbDistribution
All Implemented Interfaces:
RealValuedDomainOps
Direct Known Subclasses:
ChiSquareDistr, FDistr, GaussianDistr, KDistr, StudentsTDistr

public abstract class ProbDistribution extends Object implements RealValuedDomainOps
Class representing probability distributions.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    A(double x)
    Get the probability that a value is within the range [-x, x].
    cdf()
    Get the cumulative distribution function.
    Get the complement of the cumulative distribution function.
    boolean
    Determine if the domain maximum is in the domain.
    boolean
    Determine if the domain minimum is in the domain.
    double
    Get the maximum value in the domain of the function.
    double
    Get the minimum value in the domain of the function.
    double
    inverseA(double x)
    Get the inverse for the method A(double).
    double
    inverseP(double x)
    Get the inverse for the method P(double).
    double
    inverseQ(double x)
    Get the inverse for the method Q(double).
    boolean
    isInDomain(double x)
    Determine if an argument is within the domain of the functions providing a probability density or cumulative probability.
    abstract boolean
    isSymmetric(double x)
    Determine if this distribution is symmetric about x.
    abstract double
    P(double x)
    Get the probability that a value is no larger than the argument
    double
    pd(double x)
    Get the probability density
    double
    Q(double x)
    Get the probability that a value is no smaller than the argument

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ProbDistribution

      public ProbDistribution()
  • Method Details

    • isSymmetric

      public abstract boolean isSymmetric(double x)
      Determine if this distribution is symmetric about x. A distribution is symmetric if its probability density f satisfies f(x+y) = f(x-y) and that if x+y is in f's domain, so is x-y. Equivalently, it must satisfy Q(x+y) = P(x-y).
      Parameters:
      x - the point about which to test if this distribution is symmaetric
      Returns:
      true if it is symmetric; false otherwise.
    • cdf

      public RealValuedFunction cdf()
      Get the cumulative distribution function.
      Returns:
      the cumulative distribution function
    • cdfc

      public RealValuedFunction cdfc()
      Get the complement of the cumulative distribution function.
      Returns:
      the complement of the cumulative distribution function
    • pd

      public double pd(double x) throws UnsupportedOperationException, IllegalArgumentException
      Get the probability density
      Parameters:
      x - the value for which the density is to be computed
      Returns:
      the probability density
      Throws:
      UnsupportedOperationException - this instance does not support this operation
      IllegalArgumentException - the argument was out of range
    • P

      public abstract double P(double x) throws IllegalArgumentException
      Get the probability that a value is no larger than the argument
      Parameters:
      x - the argument
      Returns:
      the probability
      Throws:
      IllegalArgumentException - the argument was out of range
    • Q

      public double Q(double x) throws IllegalArgumentException
      Get the probability that a value is no smaller than the argument
      Parameters:
      x - the argument
      Returns:
      the probability
      Throws:
      IllegalArgumentException
    • A

      public double A(double x) throws UnsupportedOperationException, IllegalArgumentException
      Get the probability that a value is within the range [-x, x]. This method is meaningful for distributions that are symmetric about 0. When this is not the case, an UnsupportedOperationException should be thrown.
      Parameters:
      x - the argument
      Returns:
      the probability that a value is in the range [-x, x]
      Throws:
      UnsupportedOperationException - this operation is not supported
      IllegalArgumentException - the argument was out of range
    • inverseP

      public double inverseP(double x) throws MathException
      Get the inverse for the method P(double).
      Parameters:
      x - an argument in the range [0.0, 1.0]
      Returns:
      a value y such that x = P(y)
      Throws:
      MathException - an error occurred while computing the inverse
      IllegalArgumentException - the argument was out of range
    • inverseQ

      public double inverseQ(double x)
      Get the inverse for the method Q(double).
      Parameters:
      x - an argument in the range [0.0, 1.0]
      Returns:
      a value y such that x = Q(y)
      Throws:
      MathException - an error occurred while computing the inverse
      IllegalArgumentException - the argument was out of range
    • inverseA

      public double inverseA(double x)
      Get the inverse for the method A(double).
      Parameters:
      x - the argument
      Returns:
      a value y such that x = A(y)
      Throws:
      MathException - an error occurred while computing the inverse
      IllegalArgumentException - the argument was out of range
      UnsupportedOperationException - the operation was not supported
    • getDomainMax

      public double getDomainMax()
      Description copied from interface: RealValuedDomainOps
      Get the maximum value in the domain of the function.
      Specified by:
      getDomainMax in interface RealValuedDomainOps
      Returns:
      the maximum value
    • domainMaxClosed

      public boolean domainMaxClosed()
      Description copied from interface: RealValuedDomainOps
      Determine if the domain maximum is in the domain.
      Specified by:
      domainMaxClosed in interface RealValuedDomainOps
      Returns:
      true if the domain maximum is in the domain; false if it is the least upper bound for the domain
    • getDomainMin

      public double getDomainMin()
      Description copied from interface: RealValuedDomainOps
      Get the minimum value in the domain of the function.
      Specified by:
      getDomainMin in interface RealValuedDomainOps
      Returns:
      the minimum value
    • domainMinClosed

      public boolean domainMinClosed()
      Description copied from interface: RealValuedDomainOps
      Determine if the domain minimum is in the domain.
      Specified by:
      domainMinClosed in interface RealValuedDomainOps
      Returns:
      true if the domain minimum is in the domain; false if it is the greatest lower bound for the domain
    • isInDomain

      public boolean isInDomain(double x) throws UnsupportedOperationException
      Determine if an argument is within the domain of the functions providing a probability density or cumulative probability.

      The default behavior of this method assumes the domain is an interval and uses the methods getDomainMin(), getDomainMin(), domainMinClosed(), and domainMinClosed() to determine if the argument represents a point in the functions domain. If the domain is not an interval with each end either open or closed, then this method must be overridden. If it is not possible with a reasonable amount of computation to determine that the argument is in the domain, an UnsupportedOperationException may be thrown. If this exception is thrown, it should be thrown regardless of the argument.

      Specified by:
      isInDomain in interface RealValuedDomainOps
      Parameters:
      x - a value to test
      Returns:
      true if x is in this function's domain; false otherwise
      Throws:
      UnsupportedOperationException - domain membership could not be determined.