public abstract class AbstractRealDistribution extends Object implements RealDistribution, Serializable
Default implementations are provided for some of the methods that do not vary from distribution to distribution.
Modifier and Type | Field and Description |
---|---|
protected static double |
DEFAULT_SOLVER_ABSOLUTE_ACCURACY
Default absolute accuracy for inverse cumulative computation.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractRealDistribution()
Create a real distribution with default solver absolute accuracy.
|
protected |
AbstractRealDistribution(double solverAbsoluteAccuracy) |
Modifier and Type | Method and Description |
---|---|
protected double |
getSolverAbsoluteAccuracy()
Returns the solver absolute accuracy for inverse cumulative computation.
|
double |
inverseCumulativeProbability(double p)
Computes the quantile function of this distribution.
|
double |
logDensity(double x)
Returns the natural logarithm of the probability density function
(PDF) of this distribution evaluated at the specified point
x . |
double |
probability(double x0,
double x1)
For a random variable
X whose values are distributed according
to this distribution, this method returns P(x0 < X <= x1) . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cumulativeProbability, density, getNumericalMean, getNumericalVariance, getSupportLowerBound, getSupportUpperBound, isSupportConnected
protected static final double DEFAULT_SOLVER_ABSOLUTE_ACCURACY
protected AbstractRealDistribution(double solverAbsoluteAccuracy)
solverAbsoluteAccuracy
- the absolute accuracy to use when
computing the inverse cumulative probability.protected AbstractRealDistribution()
public double probability(double x0, double x1) throws MathIllegalArgumentException
X
whose values are distributed according
to this distribution, this method returns P(x0 < X <= x1)
.probability
in interface RealDistribution
x0
- Lower bound (excluded).x1
- Upper bound (included).x0
and x1
, excluding the lower
and including the upper endpoint.MathIllegalArgumentException
- if x0 > x1
.
The default implementation uses the identity
P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)
public double inverseCumulativeProbability(double p) throws MathIllegalArgumentException
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
.RealDistribution.getSupportLowerBound()
for p = 0
,RealDistribution.getSupportUpperBound()
for p = 1
.inverseCumulativeProbability
in interface RealDistribution
p
- the cumulative probabilityp
-quantile of this distribution
(largest 0-quantile for p = 0
)MathIllegalArgumentException
- if p < 0
or p > 1
protected double getSolverAbsoluteAccuracy()
public double logDensity(double x)
x
.
In general, the PDF is the derivative of the CDF
.
If the derivative does not exist at x
, then an appropriate replacement
should be returned, e.g. Double.POSITIVE_INFINITY
, Double.NaN
,
or the limit inferior or limit superior of the difference quotient. Note that
due to the floating point precision and under/overflow issues, this method will
for some distributions be more precise and faster than computing the logarithm of
RealDistribution.density(double)
.
The default implementation simply computes the logarithm of density(x)
.
logDensity
in interface RealDistribution
x
- the point at which the PDF is evaluatedx
Copyright © 2016-2022 CS GROUP. All rights reserved.