Class BivariateNormalDistribution
- java.lang.Object
-
- com.opengamma.strata.math.impl.statistics.distribution.BivariateNormalDistribution
-
- All Implemented Interfaces:
ProbabilityDistribution<double[]>
public class BivariateNormalDistribution extends Object implements ProbabilityDistribution<double[]>
The bivariate normal distribution is a continuous probability distribution of two variables, $x$ and $y$, with cdf $$ \begin{align*} M(x, y, \rho) = \frac{1}{2\pi\sqrt{1 - \rho^2}}\int_{-\infty}^x\int_{-\infty}^{y} e^{\frac{-(X^2 - 2\rho XY + Y^2)}{2(1 - \rho^2)}} dX dY \end{align*} $$ where $\rho$ is the correlation between $x$ and $y$.The implementation of the cdf is taken from "Better Approximations to Cumulative Normal Functions", West (link).
-
-
Constructor Summary
Constructors Constructor Description BivariateNormalDistribution()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getCDF(double[] x)
Calculates CDF.double
getInverseCDF(double[] p)
Given a probability, return the value that returns this cdfdouble
getPDF(double[] x)
Calculates PDF.double
nextRandom()
-
-
-
Method Detail
-
getCDF
public double getCDF(double[] x)
Calculates CDF.- Specified by:
getCDF
in interfaceProbabilityDistribution<double[]>
- Parameters:
x
- The parameters for the function, $(x, y, \rho$, with $-1 \geq \rho \geq 1$, not null- Returns:
- The cdf
-
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:
- Not supported
- Throws:
UnsupportedOperationException
- always
-
getPDF
public double getPDF(double[] x)
Calculates PDF.- Specified by:
getPDF
in interfaceProbabilityDistribution<double[]>
- Parameters:
x
- The parameters for the function, $(x, y, \rho$, with $-1 \geq \rho \geq 1$, not null- Returns:
- The pdf
-
nextRandom
public double nextRandom()
- Specified by:
nextRandom
in interfaceProbabilityDistribution<double[]>
- Returns:
- Not supported
- Throws:
UnsupportedOperationException
- always
-
-