Class 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 Detail

      • BivariateNormalDistribution

        public BivariateNormalDistribution()
    • Method Detail

      • getCDF

        public double getCDF​(double[] x)
        Calculates CDF.
        Specified by:
        getCDF in interface ProbabilityDistribution<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 interface ProbabilityDistribution<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 interface ProbabilityDistribution<double[]>
        Parameters:
        x - The parameters for the function, $(x, y, \rho$, with $-1 \geq \rho \geq 1$, not null
        Returns:
        The pdf