|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.math3.distribution.AbstractRealDistribution
public abstract class AbstractRealDistribution
Base class for probability distributions on the reals. Default implementations are provided for some of the methods that do not vary from distribution to distribution.
Field Summary | |
---|---|
protected RandomGenerator |
random
RNG instance used to generate samples from the distribution. |
protected RandomDataImpl |
randomData
Deprecated. As of 3.1, to be removed in 4.0. Please use the random instance variable instead. |
static double |
SOLVER_DEFAULT_ABSOLUTE_ACCURACY
Default accuracy. |
Constructor Summary | |
---|---|
protected |
AbstractRealDistribution()
Deprecated. As of 3.1, to be removed in 4.0. Please use AbstractRealDistribution(RandomGenerator) instead. |
protected |
AbstractRealDistribution(RandomGenerator rng)
|
Method Summary | |
---|---|
double |
cumulativeProbability(double x0,
double x1)
Deprecated. As of 3.1 (to be removed in 4.0). Please use probability(double,double) instead. |
protected double |
getSolverAbsoluteAccuracy()
Returns the solver absolute accuracy for inverse cumulative computation. |
double |
inverseCumulativeProbability(double p)
Computes the quantile function of this distribution. |
double |
probability(double x)
For a random variable X whose values are distributed according
to this distribution, this method returns P(X = 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) . |
void |
reseedRandomGenerator(long seed)
Reseed the random generator used to generate samples. |
double |
sample()
Generate a random value sampled from this distribution. |
double[] |
sample(int sampleSize)
Generate a random sample from the distribution. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.commons.math3.distribution.RealDistribution |
---|
cumulativeProbability, density, getNumericalMean, getNumericalVariance, getSupportLowerBound, getSupportUpperBound, isSupportConnected, isSupportLowerBoundInclusive, isSupportUpperBoundInclusive |
Field Detail |
---|
public static final double SOLVER_DEFAULT_ABSOLUTE_ACCURACY
@Deprecated protected RandomDataImpl randomData
random
instance variable instead.
protected final RandomGenerator random
Constructor Detail |
---|
@Deprecated protected AbstractRealDistribution()
AbstractRealDistribution(RandomGenerator)
instead.
protected AbstractRealDistribution(RandomGenerator rng)
rng
- Random number generator.Method Detail |
---|
@Deprecated public double cumulativeProbability(double x0, double x1) throws NumberIsTooLargeException
probability(double,double)
instead.
X
whose values are distributed according
to this distribution, this method returns P(x0 < X <= x1)
.
The default implementation uses the identity
P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)
cumulativeProbability
in interface RealDistribution
x0
- the exclusive lower boundx1
- the inclusive upper bound
x0
and x1
,
excluding the lower and including the upper endpoint
NumberIsTooLargeException
- if x0 > x1
public double probability(double x0, double x1)
X
whose values are distributed according
to this distribution, this method returns P(x0 < X <= x1)
.
x0
- Lower bound (excluded).x1
- Upper bound (included).
x0
and x1
, excluding the lower
and including the upper endpoint.
NumberIsTooLargeException
- 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 OutOfRangeException
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 probability
p
-quantile of this distribution
(largest 0-quantile for p = 0
)
OutOfRangeException
- if p < 0
or p > 1
protected double getSolverAbsoluteAccuracy()
public void reseedRandomGenerator(long seed)
reseedRandomGenerator
in interface RealDistribution
seed
- the new seedpublic double sample()
sample
in interface RealDistribution
public double[] sample(int sampleSize)
sample()
in a loop.
sample
in interface RealDistribution
sampleSize
- the number of random values to generate
public double probability(double x)
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.
probability
in interface RealDistribution
x
- the point at which the PMF is evaluated
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |