public abstract class AbstractIntegerDistribution extends Object implements IntegerDistribution, Serializable
Modifier and Type | Method and Description |
---|---|
double |
cumulativeProbability(int x0,
int x1)
For a random variable
X whose values are distributed according
to this distribution, this method returns P(x0 < X <= x1) . |
int |
inverseCumulativeProbability(double p)
Computes the quantile function of this distribution.
|
double |
logProbability(int x)
For a random variable
X whose values are distributed according to
this distribution, this method returns log(P(X = x)) , where
log is the natural logarithm. |
void |
reseedRandomGenerator(long seed)
Reseed the random generator used to generate samples.
|
int |
sample()
Generate a random value sampled from this distribution.
|
int[] |
sample(int sampleSize)
Generate a random sample from the distribution.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cumulativeProbability, getNumericalMean, getNumericalVariance, getSupportLowerBound, getSupportUpperBound, isSupportConnected, probability
public double cumulativeProbability(int x0, int x1) throws NumberIsTooLargeException
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 IntegerDistribution
x0
- the exclusive lower boundx1
- the inclusive upper boundx0
and x1
,
excluding the lower and including the upper endpointNumberIsTooLargeException
- if x0 > x1
public int inverseCumulativeProbability(double p) throws OutOfRangeException
X
distributed according to this distribution,
the returned value is
inf{x in Z | P(X<=x) >= p}
for 0 < p <= 1
,inf{x in Z | P(X<=x) > 0}
for p = 0
.int
,
then Integer.MIN_VALUE
or Integer.MAX_VALUE
is returned.
The default implementation returns
IntegerDistribution.getSupportLowerBound()
for p = 0
,IntegerDistribution.getSupportUpperBound()
for p = 1
, andsolveInverseCumulativeProbability(double, int, int)
for
0 < p < 1
.inverseCumulativeProbability
in interface IntegerDistribution
p
- the cumulative probabilityp
-quantile of this distribution
(largest 0-quantile for p = 0
)OutOfRangeException
- if p < 0
or p > 1
public void reseedRandomGenerator(long seed)
reseedRandomGenerator
in interface IntegerDistribution
seed
- the new seedpublic int sample()
sample
in interface IntegerDistribution
public int[] sample(int sampleSize)
sample()
in a loop.sample
in interface IntegerDistribution
sampleSize
- the number of random values to generatepublic double logProbability(int x)
X
whose values are distributed according to
this distribution, this method returns log(P(X = x))
, where
log
is the natural logarithm. In other words, this method
represents the logarithm of the probability mass function (PMF) for the
distribution. 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
IntegerDistribution.probability(int)
.
The default implementation simply computes the logarithm of probability(x)
.
x
- the point at which the PMF is evaluatedx
Jas4pp 1.5 © Java Analysis Studio for Particle Physics