|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.math.distribution.AbstractDistribution
org.apache.commons.math.distribution.AbstractIntegerDistribution
public abstract class AbstractIntegerDistribution
Base class for integer-valued discrete distributions. Default implementations are provided for some of the methods that do not vary from distribution to distribution.
| Field Summary | |
|---|---|
protected RandomDataImpl |
randomData
RandomData instance used to generate samples from the distribution. |
| Constructor Summary | |
|---|---|
protected |
AbstractIntegerDistribution()
Default constructor. |
| Method Summary | |
|---|---|
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. |
abstract int |
getSupportLowerBound()
Access the lower bound of the support. |
abstract int |
getSupportUpperBound()
Access the upper bound of the support. |
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)
Reseed 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. |
| Methods inherited from class org.apache.commons.math.distribution.AbstractDistribution |
|---|
calculateNumericalMean, calculateNumericalVariance, getNumericalMean, getNumericalVariance, isSupportConnected |
| 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.math.distribution.IntegerDistribution |
|---|
probability |
| Methods inherited from interface org.apache.commons.math.distribution.Distribution |
|---|
getNumericalMean, getNumericalVariance, isSupportConnected |
| Field Detail |
|---|
protected final RandomDataImpl randomData
| Constructor Detail |
|---|
protected AbstractIntegerDistribution()
| Method Detail |
|---|
public double cumulativeProbability(double x)
X whose values are distributed according
to this distribution, this method returns P(X <= x). In other
words, this method represents the (cumulative) distribution function,
or CDF, for this distribution.
If x does not represent an integer value, the CDF is
evaluated at the greatest integer less than x.
cumulativeProbability in interface Distributionx - Value at which the distribution function is evaluated.
x.
public double cumulativeProbability(double x0,
double x1)
X whose values are distributed
according to this distribution, this method returns
P(x0 <= X <= x1).
cumulativeProbability in interface DistributioncumulativeProbability in class AbstractDistributionx0 - Inclusive lower bound.x1 - Inclusive upper bound.
x0 and x1,
including the endpoints.
NumberIsTooSmallException - if x1 > x0.public abstract double cumulativeProbability(int x)
X whose values are distributed according
to this distribution, this method returns P(X <= x). In other
words, this method represents the probability distribution function,
or PDF, for this distribution.
cumulativeProbability in interface IntegerDistributionx - Value at which the PDF is evaluated.
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, or PMF,
for the distribution.
If x does not represent an integer value, 0 is returned.
probability in interface DiscreteDistributionx - Value at which the probability density function is evaluated.
x.
public double cumulativeProbability(int x0,
int x1)
X whose values are distributed according
to this distribution, this method returns P(x0 < X < x1).
cumulativeProbability in interface IntegerDistributionx0 - Inclusive lower bound.x1 - Inclusive upper bound.
NumberIsTooSmallException - if x0 > x1.public int inverseCumulativeProbability(double p)
X whose values are distributed according
to this distribution, this method returns the largest x, such
that P(X <= x) <= p.
inverseCumulativeProbability in interface IntegerDistributionp - Desired probability.
x such that P(X < x) <= p.
OutOfRangeException - if p < 0 or p > 1.public void reseedRandomGenerator(long seed)
reseedRandomGenerator in interface IntegerDistributionseed - New seed.public int sample()
sample in interface IntegerDistributionpublic int[] sample(int sampleSize)
sample()
in a loop.
sample in interface IntegerDistributionsampleSize - number of random values to generate.
NotStrictlyPositiveException - if sampleSize <= 0.protected abstract int getDomainLowerBound(double p)
p, used to
bracket a PDF root. This method is used by
inverseCumulativeProbability(double) to find critical values.
p - Desired probability for the critical value
P(X < 'lower bound') < p.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 - Desired probability for the critical value.
P(X < 'upper bound') > p.public abstract int getSupportLowerBound()
public abstract int getSupportUpperBound()
public boolean isSupportLowerBoundInclusive()
isSupportLowerBoundInclusive in interface DistributionisSupportLowerBoundInclusive in class AbstractDistributionpublic boolean isSupportUpperBoundInclusive()
isSupportUpperBoundInclusive in interface DistributionisSupportUpperBoundInclusive in class AbstractDistribution
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||