public abstract class AbstractIntegerDistribution extends AbstractDistribution implements IntegerDistribution, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected RandomDataImpl |
randomData
RandomData instance used to generate samples from the distribution
|
private static long |
serialVersionUID
Serializable version identifier
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractIntegerDistribution()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
private double |
checkedCumulativeProbability(int argument)
Computes the cumulative probability function and checks for NaN values returned.
|
double |
cumulativeProbability(double x)
For a random variable X whose values are distributed according
to this distribution, this method returns P(X ≤ x).
|
double |
cumulativeProbability(double x0,
double x1)
For a random variable X whose values are distributed according
to this distribution, this method returns P(x0 ≤ X ≤ x1).
|
abstract double |
cumulativeProbability(int x)
For a random variable X whose values are distributed according
to this distribution, this method returns P(X ≤ x).
|
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).
|
protected abstract int |
getDomainLowerBound(double p)
Access the domain value lower bound, based on
p , used to
bracket a PDF root. |
protected abstract int |
getDomainUpperBound(double p)
Access the domain value upper bound, based on
p , used to
bracket a PDF root. |
int |
inverseCumulativeProbability(double p)
For a random variable X whose values are distributed according
to this distribution, this method returns the largest x, such
that P(X ≤ x) ≤
p . |
boolean |
isSupportLowerBoundInclusive()
Use this method to get information about whether the lower bound
of the support is inclusive or not.
|
boolean |
isSupportUpperBoundInclusive()
Use this method to get information about whether the upper bound
of the support is inclusive or not.
|
double |
probability(double x)
For a random variable X whose values are distributed according
to this distribution, this method returns P(X = x).
|
void |
reseedRandomGenerator(long seed)
Reseeds the random generator used to generate samples.
|
int |
sample()
Generates a random value sampled from this distribution.
|
int[] |
sample(int sampleSize)
Generates a random sample from the distribution.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
probability
private static final long serialVersionUID
protected final RandomDataImpl randomData
protected AbstractIntegerDistribution()
public double cumulativeProbability(double x) throws MathException
If x
does not represent an integer value, the CDF is
evaluated at the greatest integer less than x.
cumulativeProbability
in interface Distribution
x
- the value at which the distribution function is evaluated.x
MathException
- if the cumulative probability can not be
computed due to convergence or other numerical errors.public double cumulativeProbability(double x0, double x1) throws MathException
cumulativeProbability
in interface Distribution
cumulativeProbability
in class AbstractDistribution
x0
- the (inclusive) lower boundx1
- the (inclusive) upper boundx0
and x1
,
including the endpoints.MathException
- if the cumulative probability can not be
computed due to convergence or other numerical errors.java.lang.IllegalArgumentException
- if x0 > x1
public abstract double cumulativeProbability(int x) throws MathException
cumulativeProbability
in interface IntegerDistribution
x
- the value at which the PDF is evaluated.MathException
- if the cumulative probability can not be
computed due to convergence or other numerical errors.public double probability(double x)
If x
does not represent an integer value, 0 is returned.
probability
in interface DiscreteDistribution
x
- the value at which the probability density function is evaluatedpublic double cumulativeProbability(int x0, int x1) throws MathException
cumulativeProbability
in interface IntegerDistribution
x0
- the inclusive, lower boundx1
- the inclusive, upper boundMathException
- if the cumulative probability can not be
computed due to convergence or other numerical errors.java.lang.IllegalArgumentException
- if x0 > x1public int inverseCumulativeProbability(double p) throws MathException
p
.inverseCumulativeProbability
in interface IntegerDistribution
p
- the desired probabilityMathException
- if the inverse cumulative probability can not be
computed due to convergence or other numerical errors.java.lang.IllegalArgumentException
- if p < 0 or p > 1public void reseedRandomGenerator(long seed)
seed
- the new seedpublic int sample() throws MathException
MathException
- if an error occurs generating the random valuepublic int[] sample(int sampleSize) throws MathException
sample()
in a loop.sampleSize
- number of random values to generateMathException
- if an error occurs generating the samplejava.lang.IllegalArgumentException
- if sampleSize is not positiveprivate double checkedCumulativeProbability(int argument) throws MathException
argument
- input valueMathException
- if the cumulative probability is NaNprotected abstract int getDomainLowerBound(double p)
p
, used to
bracket a PDF root. This method is used by
inverseCumulativeProbability(double)
to find critical values.p
- the desired probability for the critical valuep
protected abstract int getDomainUpperBound(double p)
p
, used to
bracket a PDF root. This method is used by
inverseCumulativeProbability(double)
to find critical values.p
- the desired probability for the critical valuep
public boolean isSupportLowerBoundInclusive()
public boolean isSupportUpperBoundInclusive()
Copyright (c) 2003-2014 Apache Software Foundation