Class NormalDistribution
- java.lang.Object
-
- com.opengamma.strata.math.impl.statistics.distribution.NormalDistribution
-
- All Implemented Interfaces:
ProbabilityDistribution<Double>
public class NormalDistribution extends Object implements ProbabilityDistribution<Double>
The normal distribution is a continuous probability distribution with probability density function $$ \begin{align*} f(x) = \frac{1}{\sqrt{2\pi}\sigma} e^{-\frac{(x - \mu)^2}{2\sigma^2}} \end{align*} $$ where $\mu$ is the mean and $\sigma$ the standard deviation of the distribution.
-
-
Constructor Summary
Constructors Constructor Description NormalDistribution(double mean, double standardDeviation)
NormalDistribution(double mean, double standardDeviation, RandomEngine randomEngine)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
double
getCDF(Double x)
Returns the cumulative distribution function for a valuedouble
getInverseCDF(Double p)
Given a probability, return the value that returns this cdfdouble
getMean()
double
getPDF(Double x)
Return the probability density function for a valuedouble
getStandardDeviation()
int
hashCode()
double
nextRandom()
-
-
-
Constructor Detail
-
NormalDistribution
public NormalDistribution(double mean, double standardDeviation)
- Parameters:
mean
- The mean of the distributionstandardDeviation
- The standard deviation of the distribution, not negative or zero
-
NormalDistribution
public NormalDistribution(double mean, double standardDeviation, RandomEngine randomEngine)
- Parameters:
mean
- The mean of the distributionstandardDeviation
- The standard deviation of the distribution, not negative or zerorandomEngine
- A generator of uniform random numbers, not null
-
-
Method Detail
-
getCDF
public double getCDF(Double x)
Returns the cumulative distribution function for a value- Specified by:
getCDF
in interfaceProbabilityDistribution<Double>
- Parameters:
x
- The value, not null- Returns:
- The cdf
-
getPDF
public double getPDF(Double x)
Return the probability density function for a value- Specified by:
getPDF
in interfaceProbabilityDistribution<Double>
- Parameters:
x
- The value, not null- Returns:
- The pdf
-
nextRandom
public double nextRandom()
- Specified by:
nextRandom
in interfaceProbabilityDistribution<Double>
- Returns:
- The next random number from this distribution
-
getInverseCDF
public double getInverseCDF(Double p)
Given a probability, return the value that returns this cdf- Specified by:
getInverseCDF
in interfaceProbabilityDistribution<Double>
- Parameters:
p
- The probability, not null. $0 \geq p \geq 1$- Returns:
- The inverse cdf
-
getMean
public double getMean()
- Returns:
- The mean
-
getStandardDeviation
public double getStandardDeviation()
- Returns:
- The standard deviation
-
-