public abstract class AbstractContinuousDistribution extends AbstractDistribution implements ContinuousDistribution, 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
|
private double |
solverAbsoluteAccuracy
Solver absolute accuracy for inverse cumulative computation
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractContinuousDistribution()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
density(double x)
Return the probability density for a particular point.
|
protected abstract double |
getDomainLowerBound(double p)
Access the domain value lower bound, based on
p , used to
bracket a CDF root. |
protected abstract double |
getDomainUpperBound(double p)
Access the domain value upper bound, based on
p , used to
bracket a CDF root. |
protected abstract double |
getInitialDomain(double p)
Access the initial domain value, based on
p , used to
bracket a CDF root. |
protected double |
getSolverAbsoluteAccuracy()
Returns the solver absolute accuracy for inverse cumulative computation.
|
double |
inverseCumulativeProbability(double p)
For this distribution, X, this method returns the critical point x, such
that P(X < x) =
p . |
void |
reseedRandomGenerator(long seed)
Reseeds the random generator used to generate samples.
|
double |
sample()
Generates a random value sampled from this distribution.
|
double[] |
sample(int sampleSize)
Generates a random sample from the distribution.
|
cumulativeProbability
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cumulativeProbability, cumulativeProbability
private static final long serialVersionUID
protected final RandomDataImpl randomData
private double solverAbsoluteAccuracy
protected AbstractContinuousDistribution()
public double density(double x) throws MathRuntimeException
x
- The point at which the density should be computed.MathRuntimeException
- if the specialized class hasn't implemented this functionpublic double inverseCumulativeProbability(double p) throws MathException
p
.inverseCumulativeProbability
in interface ContinuousDistribution
p
- the desired probabilityp
MathException
- if the inverse cumulative probability can not be
computed due to convergence or other numerical errors.IllegalArgumentException
- if p
is not a valid
probability.public void reseedRandomGenerator(long seed)
seed
- the new seedpublic double sample() throws MathException
MathException
- if an error occurs generating the random valuepublic double[] sample(int sampleSize) throws MathException
sample()
in a loop.sampleSize
- number of random values to generateMathException
- if an error occurs generating the sampleIllegalArgumentException
- if sampleSize is not positiveprotected abstract double getInitialDomain(double p)
p
, used to
bracket a CDF root. This method is used by
inverseCumulativeProbability(double)
to find critical values.p
- the desired probability for the critical valueprotected abstract double getDomainLowerBound(double p)
p
, used to
bracket a CDF root. This method is used by
inverseCumulativeProbability(double)
to find critical values.p
- the desired probability for the critical valuep
protected abstract double getDomainUpperBound(double p)
p
, used to
bracket a CDF root. This method is used by
inverseCumulativeProbability(double)
to find critical values.p
- the desired probability for the critical valuep
protected double getSolverAbsoluteAccuracy()
Copyright (c) 2003-2014 Apache Software Foundation