|
||||||||||
| 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.AbstractContinuousDistribution
org.apache.commons.math.distribution.NormalDistributionImpl
public class NormalDistributionImpl
Default implementation of
NormalDistribution.
| Field Summary | |
|---|---|
static double |
DEFAULT_INVERSE_ABSOLUTE_ACCURACY
Default inverse cumulative probability accuracy. |
| Fields inherited from class org.apache.commons.math.distribution.AbstractContinuousDistribution |
|---|
randomData, SOLVER_DEFAULT_ABSOLUTE_ACCURACY |
| Constructor Summary | |
|---|---|
NormalDistributionImpl()
Create a normal distribution with mean equal to zero and standard deviation equal to one. |
|
NormalDistributionImpl(double mean,
double sd)
Create a normal distribution using the given mean and standard deviation. |
|
NormalDistributionImpl(double mean,
double sd,
double inverseCumAccuracy)
Create a normal distribution using the given mean, standard deviation and inverse cumulative distribution accuracy. |
|
| Method Summary | |
|---|---|
protected double |
calculateNumericalMean()
Use this method to actually calculate the mean for the specific distribution. |
protected double |
calculateNumericalVariance()
Use this method to actually calculate the variance for the specific distribution. |
double |
cumulativeProbability(double x)
For this distribution, X, 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). |
double |
density(double x)
Probability density for a particular point. |
protected double |
getDomainLowerBound(double p)
Access the domain value lower bound, based on p, used to
bracket a CDF root. |
protected double |
getDomainUpperBound(double p)
Access the domain value upper bound, based on p, used to
bracket a CDF root. |
protected double |
getInitialDomain(double p)
Access the initial domain value, based on p, used to
bracket a CDF root. |
double |
getMean()
Access the mean. |
protected double |
getSolverAbsoluteAccuracy()
Return the absolute accuracy setting of the solver used to estimate inverse cumulative probabilities. |
double |
getStandardDeviation()
Access the standard deviation. |
double |
getSupportLowerBound()
Access the lower bound of the support. |
double |
getSupportUpperBound()
Access the upper bound of the support. |
double |
inverseCumulativeProbability(double p)
For this distribution, X, this method returns the critical point 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 |
sample()
Generate a random value sampled from this distribution. |
| Methods inherited from class org.apache.commons.math.distribution.AbstractContinuousDistribution |
|---|
reseedRandomGenerator, sample |
| Methods inherited from class org.apache.commons.math.distribution.AbstractDistribution |
|---|
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.ContinuousDistribution |
|---|
reseedRandomGenerator, sample |
| Methods inherited from interface org.apache.commons.math.distribution.Distribution |
|---|
getNumericalMean, getNumericalVariance, isSupportConnected |
| Field Detail |
|---|
public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY
| Constructor Detail |
|---|
public NormalDistributionImpl(double mean,
double sd)
mean - Mean for this distribution.sd - Standard deviation for this distribution.
public NormalDistributionImpl(double mean,
double sd,
double inverseCumAccuracy)
mean - Mean for this distribution.sd - Standard deviation for this distribution.inverseCumAccuracy - Inverse cumulative probability accuracy.
NotStrictlyPositiveException - if sd <= 0.public NormalDistributionImpl()
| Method Detail |
|---|
public double getMean()
getMean in interface NormalDistributionpublic double getStandardDeviation()
getStandardDeviation in interface NormalDistributionpublic double density(double x)
density in interface ContinuousDistributiondensity in class AbstractContinuousDistributionx - Point at which the density should be computed.
x.public double cumulativeProbability(double x)
X, this method returns P(X < x).
If xis more than 40 standard deviations from the mean, 0 or 1 is returned,
as in these cases the actual value is within Double.MIN_VALUE of 0 or 1.
cumulativeProbability in interface Distributionx - Value at which the CDF is evaluated.
x.
public double cumulativeProbability(double x0,
double x1)
The default implementation uses the identity
P(x0 ≤ X ≤ x1) = P(X ≤ x1) - P(X ≤ x0)
cumulativeProbability in interface DistributioncumulativeProbability in class AbstractDistributionx0 - the (inclusive) lower boundx1 - the (inclusive) upper bound
x0 and x1,
including the endpoints.protected double getSolverAbsoluteAccuracy()
getSolverAbsoluteAccuracy in class AbstractContinuousDistributionpublic double inverseCumulativeProbability(double p)
x, such that P(X < x) = p.
It will return Double.NEGATIVE_INFINITY when p = 0 and
Double.POSITIVE_INFINITY for p = 1.
inverseCumulativeProbability in interface ContinuousDistributioninverseCumulativeProbability in class AbstractContinuousDistributionp - Desired probability.
x, such that P(X < x) = p.
OutOfRangeException - if
p is not a valid probability.public double sample()
sample in interface ContinuousDistributionsample in class AbstractContinuousDistributionprotected double getDomainLowerBound(double p)
p, used to
bracket a CDF root. This method is used by
inverseCumulativeProbability(double) to find critical values.
getDomainLowerBound in class AbstractContinuousDistributionp - Desired probability for the critical value.
P(X < 'lower bound') < p.protected double getDomainUpperBound(double p)
p, used to
bracket a CDF root. This method is used by
inverseCumulativeProbability(double) to find critical values.
getDomainUpperBound in class AbstractContinuousDistributionp - Desired probability for the critical value.
P(X < 'upper bound') > p.protected double getInitialDomain(double p)
p, used to
bracket a CDF root. This method is used by
inverseCumulativeProbability(double) to find critical values.
getInitialDomain in class AbstractContinuousDistributionp - Desired probability for the critical value.
public double getSupportLowerBound()
getSupportLowerBound in class AbstractContinuousDistributionpublic double getSupportUpperBound()
getSupportUpperBound in class AbstractContinuousDistributionprotected double calculateNumericalMean()
AbstractDistribution.getNumericalMean()
(which implements caching) to actually get the mean.
For mean parameter mu, the mean is mu
calculateNumericalMean in class AbstractDistributionprotected double calculateNumericalVariance()
AbstractDistribution.getNumericalVariance()
(which implements caching) to actually get the variance.
For standard deviation parameter s,
the variance is s^2
calculateNumericalVariance in class AbstractDistributionpublic 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 | |||||||||