Class MultivariateNormalDistribution

java.lang.Object
org.apache.commons.math3.distribution.AbstractMultivariateRealDistribution
org.apache.commons.math3.distribution.MultivariateNormalDistribution
All Implemented Interfaces:
MultivariateRealDistribution

public class MultivariateNormalDistribution extends AbstractMultivariateRealDistribution
Implementation of the multivariate normal (Gaussian) distribution.
Since:
3.1
See Also:
  • Constructor Details

  • Method Details

    • getMeans

      public double[] getMeans()
      Gets the mean vector.
      Returns:
      the mean vector.
    • getCovariances

      public RealMatrix getCovariances()
      Gets the covariance matrix.
      Returns:
      the covariance matrix.
    • density

      public double density(double[] vals) throws DimensionMismatchException
      Returns the probability density function (PDF) of this distribution evaluated at the specified point x. In general, the PDF is the derivative of the cumulative distribution function. If the derivative does not exist at x, then an appropriate replacement should be returned, e.g. Double.POSITIVE_INFINITY, Double.NaN, or the limit inferior or limit superior of the difference quotient.
      Parameters:
      vals - Point at which the PDF is evaluated.
      Returns:
      the value of the probability density function at point x.
      Throws:
      DimensionMismatchException
    • getStandardDeviations

      public double[] getStandardDeviations()
      Gets the square root of each element on the diagonal of the covariance matrix.
      Returns:
      the standard deviations.
    • sample

      public double[] sample()
      Generates a random value vector sampled from this distribution.
      Specified by:
      sample in interface MultivariateRealDistribution
      Specified by:
      sample in class AbstractMultivariateRealDistribution
      Returns:
      a random value vector.