java.lang.Object
org.bzdev.math.stats.ProbDistribution
- All Implemented Interfaces:
RealValuedDomainOps
- Direct Known Subclasses:
ChiSquareDistr
,FDistr
,GaussianDistr
,KDistr
,StudentsTDistr
Class representing probability distributions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
A
(double x) Get the probability that a value is within the range [-x, x].cdf()
Get the cumulative distribution function.cdfc()
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 methodA(double)
.double
inverseP
(double x) Get the inverse for the methodP(double)
.double
inverseQ
(double x) Get the inverse for the methodQ(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 argumentdouble
pd
(double x) Get the probability densitydouble
Q
(double x) Get the probability that a value is no smaller than the argument
-
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
Get the cumulative distribution function.- Returns:
- the cumulative distribution function
-
cdfc
Get the complement of the cumulative distribution function.- Returns:
- the complement of the cumulative distribution function
-
pd
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 operationIllegalArgumentException
- the argument was out of range
-
P
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
Get the probability that a value is no smaller than the argument- Parameters:
x
- the argument- Returns:
- the probability
- Throws:
IllegalArgumentException
-
A
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 supportedIllegalArgumentException
- the argument was out of range
-
inverseP
Get the inverse for the methodP(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 inverseIllegalArgumentException
- the argument was out of range
-
inverseQ
public double inverseQ(double x) Get the inverse for the methodQ(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 inverseIllegalArgumentException
- the argument was out of range
-
inverseA
public double inverseA(double x) Get the inverse for the methodA(double)
.- Parameters:
x
- the argument- Returns:
- a value y such that x = A(y)
- Throws:
MathException
- an error occurred while computing the inverseIllegalArgumentException
- the argument was out of rangeUnsupportedOperationException
- 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 interfaceRealValuedDomainOps
- 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 interfaceRealValuedDomainOps
- 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 interfaceRealValuedDomainOps
- 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 interfaceRealValuedDomainOps
- Returns:
- true if the domain minimum is in the domain; false if it is the greatest lower bound for the domain
-
isInDomain
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()
, anddomainMinClosed()
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 interfaceRealValuedDomainOps
- 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.
-