Class ProbabilityDistributions

java.lang.Object
org.mariuszgromada.math.mxparser.mathcollection.ProbabilityDistributions

public final class ProbabilityDistributions extends Object
ProbabilityDistributions - random number generators, PDF - Probability Distribution Functions, CDF - Cumulative Distribution Functions, QNT - Quantile Functions (Inverse Cumulative Distribution Functions).
Version:
5.2.0
Author:
Mariusz Gromada
MathParser.org - mXparser project page
mXparser on GitHub
INFIMA place to purchase a commercial MathParser.org-mXparser software license
info@mathparser.org
ScalarMath.org - a powerful math engine and math scripting language
Scalar Lite
Scalar Pro
MathSpace.pl
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static Random
    Random number generator
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    cdfChiSquared(double x, double k)
    Cumulative distribution function - Chi-Squared distribution
    static double
    cdfNormal(double x, double mean, double stddev)
    CDF - Cumulative Distribution Function - Normal distribution N(mean, stddev).
    static double
    cdfSnedecordF(double x, double d1, double d2)
    Cumulative distribution function - Snedecor's F distribution (F-distribution or F-ratio, also known as Fisher–Snedecor distribution)
    static double
    cdfStudentT(double x, double v)
    Cumulative distribution function - Student's t-distribution
    static double
    cdfUniformContinuous(double x, double a, double b)
    CDF - Cumulative Distribution Function - Uniform Continuous distribution over interval [a, b).
    static double
    getRandomVariableValue(int randomVariableId)
    Returns random variable value, where random variable is represented by the token id in the RandomVariable class
    static double
    pdfChiSquared(double x, double k)
    Probability distribution function - Chi-Squared distribution
    static double
    pdfNormal(double x, double mean, double stddev)
    PDF - Probability Distribution Function - Normal distribution N(mean, stddev).
    static double
    pdfSnedecordF(double x, double d1, double d2)
    Probability distribution function - Snedecor's F distribution (F-distribution or F-ratio, also known as Fisher–Snedecor distribution)
    static double
    pdfStudentT(double x, double v)
    Probability distribution function - Student's t-distribution
    static double
    pdfUniformContinuous(double x, double a, double b)
    PDF - Probability Distribution Function - Uniform Continuous distribution over interval [a, b).
    static double
    qntChiSquared(double p, double k)
    Quantile function (Inverse cumulative distribution function) - Chi-Squared distribution
    static double
    qntNormal(double q, double mean, double stddev)
    QNT - Quantile Function - Normal distribution N(mean, stddev).
    static double
    qntSnedecordF(double p, double d1, double d2)
    Quantile function (Inverse cumulative distribution function) - Snedecor's F distribution (F-distribution or F-ratio, also known as Fisher–Snedecor distribution)
    static double
    qntStudentT(double p, double v)
    Quantile function (Inverse cumulative distribution function) - Student's t-distribution
    static double
    qntUniformContinuous(double q, double a, double b)
    QNT - Quantile Function - Uniform Continuous distribution over interval [a, b).
    static double
    Random number from Uniform Continuous distribution over interval [0, 1).
    static double
    rndChiSquared(double k)
    Pseudo-random number from Chi-Squared distribution
    static int
    rndIndex(int n)
    Random index from 0 to n-1,
    static int
    rndIndex(int n, Random rnd)
    Random index from 0 to n-1,
    static int
    Random integer.
    static double
    rndInteger(double a, double b, Random rnd)
    Random number from Uniform Discrete distribution.
    static double
    rndInteger(int a, int b)
    Random number from Uniform Discrete distribution.
    static double
    rndInteger(int a, int b, Random rnd)
    Random number from Uniform Discrete distribution.
    static int
    Random integer.
    static double
    rndNormal(double mean, double stddev)
    Random number from normal distribution N(mean, stddev).
    static double
    rndNormal(double mean, double stddev, Random rnd)
    Random number from normal distribution N(mean, stddev).
    static double
    rndSnedecordF(double d1, double d2)
    Pseudo-random number from Snedecor's F distribution (F-distribution or F-ratio, also known as Fisher–Snedecor distribution)
    static double
    rndStudentT(double v)
    Pseudo-random number from Student's t-distribution
    static double
    rndUniformContinuous(double a, double b)
    Random number from dUniform Continuous distribution over interval [a, b).
    static double
    rndUniformContinuous(double a, double b, Random rnd)
    Random number from Uniform Continuous distribution over interval [a, b).
    static double
    Random number from Uniform Continuous distribution over interval [0, 1).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • randomGenerator

      public static Random randomGenerator
      Random number generator
  • Constructor Details

    • ProbabilityDistributions

      public ProbabilityDistributions()
  • Method Details

    • rndUniformContinuous

      public static double rndUniformContinuous(double a, double b, Random rnd)
      Random number from Uniform Continuous distribution over interval [a, b).
      Parameters:
      a - Interval limit - left / lower.
      b - Interval limit - right / upper.
      rnd - Random number generator.
      Returns:
      Double.NaN if a or b is null, or b is lower than a - otherwise returns random number.
    • rndUniformContinuous

      public static double rndUniformContinuous(double a, double b)
      Random number from dUniform Continuous distribution over interval [a, b).
      Parameters:
      a - Interval limit - left / lower.
      b - Interval limit - right / upper.
      Returns:
      Double.NaN if a or b is null, or b is lower than a - otherwise returns random number.
    • rndUniformContinuous

      public static double rndUniformContinuous(Random rnd)
      Random number from Uniform Continuous distribution over interval [0, 1).
      Parameters:
      rnd - Random number generator.
      Returns:
      Random number.
    • randomUniformContinuous

      public static double randomUniformContinuous()
      Random number from Uniform Continuous distribution over interval [0, 1).
      Returns:
      Random number.
    • pdfUniformContinuous

      public static double pdfUniformContinuous(double x, double a, double b)
      PDF - Probability Distribution Function - Uniform Continuous distribution over interval [a, b).
      Parameters:
      x - Point to evaluate pdf function.
      a - Interval limit - left / lower.
      b - Interval limit - right / upper.
      Returns:
      Double.NaN if a or b is null, or b is lower than a - otherwise function value.
    • cdfUniformContinuous

      public static double cdfUniformContinuous(double x, double a, double b)
      CDF - Cumulative Distribution Function - Uniform Continuous distribution over interval [a, b).
      Parameters:
      x - Point to evaluate cdf function.
      a - Interval limit - left / lower.
      b - Interval limit - right / upper.
      Returns:
      Double.NaN if a or b is null, or b is lower than a - otherwise function value.
    • qntUniformContinuous

      public static double qntUniformContinuous(double q, double a, double b)
      QNT - Quantile Function - Uniform Continuous distribution over interval [a, b). (Inverse of Cumulative Distribution Function).
      Parameters:
      q - Quantile.
      a - Interval limit - left / lower.
      b - Interval limit - right / upper.
      Returns:
      Double.NaN if a or b is null, or b is lower than a or q is lower than 0 or q is greater than 1 - otherwise function value.
    • rndInteger

      public static double rndInteger(int a, int b, Random rnd)
      Random number from Uniform Discrete distribution. over set interval (a, a+1, ..., b-1, b).
      Parameters:
      a - Interval limit - left / lower.
      b - Interval limit - right / upper.
      rnd - Random number generator.
      Returns:
      Double.NaN if a or b is null, or b is lower than a - otherwise returns random number.
    • rndInteger

      public static double rndInteger(double a, double b, Random rnd)
      Random number from Uniform Discrete distribution. over set interval (a, a+1, ..., b-1, b).
      Parameters:
      a - Interval limit - left / lower.
      b - Interval limit - right / upper.
      rnd - Random number generator.
      Returns:
      Double.NaN if a or b is null, or b is lower than a - otherwise returns random number.
    • rndInteger

      public static double rndInteger(int a, int b)
      Random number from Uniform Discrete distribution. over set interval (a, a+1, ..., b-1, b).
      Parameters:
      a - Interval limit - left / lower.
      b - Interval limit - right / upper.
      Returns:
      Double.NaN if a or b is null, or b is lower than a - otherwise returns random number.
    • rndInteger

      public static int rndInteger(Random rnd)
      Random integer.
      Parameters:
      rnd - Random number generator.
      Returns:
      Returns random number.
    • rndIndex

      public static int rndIndex(int n, Random rnd)
      Random index from 0 to n-1,
      Parameters:
      n - Bound.
      rnd - Random number generator.
      Returns:
      if n < 0 returns -1, otherwise random index.
    • rndIndex

      public static int rndIndex(int n)
      Random index from 0 to n-1,
      Parameters:
      n - Bound.
      Returns:
      if n < 0 returns -1, otherwise random index.
    • rndInteger

      public static int rndInteger()
      Random integer.
      Returns:
      Double.NaN if a or b is null, or b is lower than a - otherwise returns random number.
    • rndNormal

      public static double rndNormal(double mean, double stddev, Random rnd)
      Random number from normal distribution N(mean, stddev).
      Parameters:
      mean - Mean value.
      stddev - Standard deviation.
      rnd - Random number generator.
      Returns:
      Double.NaN if mean or stddev or rnd is null or stddev is lower than 0 - otherwise random number.
    • rndNormal

      public static double rndNormal(double mean, double stddev)
      Random number from normal distribution N(mean, stddev).
      Parameters:
      mean - Mean value.
      stddev - Standard deviation.
      Returns:
      Double.NaN if mean or stddev is null or stddev is lower than 0 - otherwise random number.
    • pdfNormal

      public static double pdfNormal(double x, double mean, double stddev)
      PDF - Probability Distribution Function - Normal distribution N(mean, stddev).
      Parameters:
      x - Point to evaluate pdf function.
      mean - Mean value.
      stddev - Standard deviation.
      Returns:
      Double.NaN if mean or stddev is null or stddev is lower than 0 - otherwise function value.
    • cdfNormal

      public static double cdfNormal(double x, double mean, double stddev)
      CDF - Cumulative Distribution Function - Normal distribution N(mean, stddev).
      Parameters:
      x - Point to evaluate pdf function.
      mean - Mean value.
      stddev - Standard deviation.
      Returns:
      Double.NaN if mean or stddev is null or stddev is lower than 0 - otherwise function value.
    • qntNormal

      public static double qntNormal(double q, double mean, double stddev)
      QNT - Quantile Function - Normal distribution N(mean, stddev). (Inverse of Cumulative Distribution Function).
      Parameters:
      q - Quantile.
      mean - Mean value.
      stddev - Standard deviation.
      Returns:
      Double.NaN if mean or stddev is null or stddev is lower than 0 or q is lower than 0 or q is greater than 1 - otherwise function value.
    • pdfStudentT

      public static double pdfStudentT(double x, double v)
      Probability distribution function - Student's t-distribution
      Parameters:
      x - Given point.
      v - Number of degrees of freedom.
      Returns:
      Returns the PDF of Student's t-distribution.
    • cdfStudentT

      public static double cdfStudentT(double x, double v)
      Cumulative distribution function - Student's t-distribution
      Parameters:
      x - Given point.
      v - Number of degrees of freedom.
      Returns:
      Returns the CDF of Student's t-distribution.
    • qntStudentT

      public static double qntStudentT(double p, double v)
      Quantile function (Inverse cumulative distribution function) - Student's t-distribution
      Parameters:
      p - Probability
      v - Number of degrees of freedom.
      Returns:
      Returns the quantile of Student's t-distribution
    • rndStudentT

      public static double rndStudentT(double v)
      Pseudo-random number from Student's t-distribution
      Parameters:
      v - Number of degrees of freedom.
      Returns:
      returns Pseudo-random number from Student's t-distribution
    • pdfChiSquared

      public static double pdfChiSquared(double x, double k)
      Probability distribution function - Chi-Squared distribution
      Parameters:
      x - Given point.
      k - Number of degrees of freedom.
      Returns:
      Returns the PDF of Chi-Squared t-distribution.
    • cdfChiSquared

      public static double cdfChiSquared(double x, double k)
      Cumulative distribution function - Chi-Squared distribution
      Parameters:
      x - Given point.
      k - Number of degrees of freedom.
      Returns:
      Returns the CDF of Chi-Squared distribution.
    • qntChiSquared

      public static double qntChiSquared(double p, double k)
      Quantile function (Inverse cumulative distribution function) - Chi-Squared distribution
      Parameters:
      p - Probability
      k - Number of degrees of freedom.
      Returns:
      Returns the quantile of Chi-Squared distribution
    • rndChiSquared

      public static double rndChiSquared(double k)
      Pseudo-random number from Chi-Squared distribution
      Parameters:
      k - Number of degrees of freedom.
      Returns:
      returns Pseudo-random number from Chi-Squared distribution
    • pdfSnedecordF

      public static double pdfSnedecordF(double x, double d1, double d2)
      Probability distribution function - Snedecor's F distribution (F-distribution or F-ratio, also known as Fisher–Snedecor distribution)
      Parameters:
      x - Real value
      d1 - Number of degrees of freedom - 1
      d2 - Number of degrees of freedom - 2
      Returns:
      Returns the PDF of Snedecor's F distribution (F-distribution or F-ratio, also known as Fisher–Snedecor distribution)
    • cdfSnedecordF

      public static double cdfSnedecordF(double x, double d1, double d2)
      Cumulative distribution function - Snedecor's F distribution (F-distribution or F-ratio, also known as Fisher–Snedecor distribution)
      Parameters:
      x - Real value
      d1 - Number of degrees of freedom - 1
      d2 - Number of degrees of freedom - 2
      Returns:
      Returns the CDF of Snedecor's F distribution (F-distribution or F-ratio, also known as Fisher–Snedecor distribution)
    • qntSnedecordF

      public static double qntSnedecordF(double p, double d1, double d2)
      Quantile function (Inverse cumulative distribution function) - Snedecor's F distribution (F-distribution or F-ratio, also known as Fisher–Snedecor distribution)
      Parameters:
      p - Probability
      d1 - Number of degrees of freedom - 1
      d2 - Number of degrees of freedom - 2
      Returns:
      Returns the quantile of Snedecor's F distribution (F-distribution or F-ratio, also known as Fisher–Snedecor distribution)
    • rndSnedecordF

      public static double rndSnedecordF(double d1, double d2)
      Pseudo-random number from Snedecor's F distribution (F-distribution or F-ratio, also known as Fisher–Snedecor distribution)
      Parameters:
      d1 - Number of degrees of freedom - 1
      d2 - Number of degrees of freedom - 2
      Returns:
      Returns Pseudo-random number from Snedecor's F distribution (F-distribution or F-ratio, also known as Fisher–Snedecor distribution)
    • getRandomVariableValue

      public static double getRandomVariableValue(int randomVariableId)
      Returns random variable value, where random variable is represented by the token id in the RandomVariable class
      Parameters:
      randomVariableId - Please refer to RandomVariable class.
      Returns:
      Returns random variable value if id is known, otherwise Double.NaN is returned.
      See Also: