com.datumbox.framework.core.statistics.distributions
Class ContinuousDistributions
- java.lang.Object
-
- com.datumbox.framework.core.statistics.distributions.ContinuousDistributions
-
public class ContinuousDistributions extends java.lang.ObjectThis class provides methods for the CDFs and PDFs of the most common continuous distributions.
-
-
Constructor Summary
Constructors Constructor and Description ContinuousDistributions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static doublebetaCdf(double x, double a, double b)Calculates the probability from 0 to X under Beta Distributionstatic doublechisquareCdf(double x, int df)Returns the probability from 0 to x of a specific chisquare score and degrees of freedomstatic doublechisquareInverseCdf(double p, int df)Returns the x score of a specific pvalue and degrees of freedom for Chisquare.static doubledirichletPdf(double[] pi, double a)Implementation for single alpha value.static doubledirichletPdf(double[] pi, double[] ai)Calculates probability pi, ai under dirichlet distributionstatic doubleexponentialCdf(double x, double lamda)Calculates the probability from 0 to X under Exponential Distributionstatic doublefCdf(double x, int f1, int f2)Calculates the probability from 0 to X under F Distributionstatic doublegamma(double x)It estimates a numeric approximation of gamma function.static doublegammaCdf(double x, double a, double b)Calculates the probability from 0 to X under Gamma Distributionstatic doublegaussCdf(double z)Returns the p-value of a specific z score for Gaussian Ported from C# code posted at http://jamesmccaffrey.wordpress.com/2010/11/05/programmatically-computing-the-area-under-the-normal-curve/static doublegaussInverseCdf(double p)Returns the z score of a specific pvalue for Gaussian Partially ported from http://home.online.no/~pjacklam/notes/invnorm/impl/karimov/StatUtil.java Other implementations http://home.online.no/~pjacklam/notes/invnorm/index.html#Javastatic doublekolmogorov(double z)Returns the cumulative probability of kolmogorovstatic doublelogGamma(double Z)Log Gamma Functionstatic doublemultinomialGaussianPdf(double[] mean, double[][] covariance, double[] x)Calculates the PDF of Multinomial Normal Distribution for a particular x.static double[]multinomialGaussianSample(double[] mean, double[][] covariance)Samples from Multinomial Normal Distribution.static doublenormalQuantile(double p, double mu, double sigma)Compute the quantile function for the normal distribution.static doublestudentsCdf(double x, int df)Calculates the probability from -INF to X under Student's Distribution Ported to PHP from Javascript implementation found at http://www.math.ucla.edu/~tom/distributions/tDist.htmlstatic doubleuniformCdf(double x, double a, double b)Returns the cumulative probability of Uniform
-
-
-
Method Detail
-
chisquareCdf
public static double chisquareCdf(double x, int df)Returns the probability from 0 to x of a specific chisquare score and degrees of freedom- Parameters:
x-df-- Returns:
-
gaussCdf
public static double gaussCdf(double z)
Returns the p-value of a specific z score for Gaussian Ported from C# code posted at http://jamesmccaffrey.wordpress.com/2010/11/05/programmatically-computing-the-area-under-the-normal-curve/- Parameters:
z-- Returns:
-
gamma
public static double gamma(double x)
It estimates a numeric approximation of gamma function.- Parameters:
x- The input x- Returns:
- The value of gamma(x)
-
logGamma
public static double logGamma(double Z)
Log Gamma Function- Parameters:
Z-- Returns:
-
studentsCdf
public static double studentsCdf(double x, int df)Calculates the probability from -INF to X under Student's Distribution Ported to PHP from Javascript implementation found at http://www.math.ucla.edu/~tom/distributions/tDist.html- Parameters:
x-df-- Returns:
-
exponentialCdf
public static double exponentialCdf(double x, double lamda)Calculates the probability from 0 to X under Exponential Distribution- Parameters:
x-lamda-- Returns:
-
betaCdf
public static double betaCdf(double x, double a, double b)Calculates the probability from 0 to X under Beta Distribution- Parameters:
x-a-b-- Returns:
-
fCdf
public static double fCdf(double x, int f1, int f2)Calculates the probability from 0 to X under F Distribution- Parameters:
x-f1-f2-- Returns:
-
gammaCdf
public static double gammaCdf(double x, double a, double b)Calculates the probability from 0 to X under Gamma Distribution- Parameters:
x-a-b-- Returns:
-
uniformCdf
public static double uniformCdf(double x, double a, double b)Returns the cumulative probability of Uniform- Parameters:
x-a-b-- Returns:
-
kolmogorov
public static double kolmogorov(double z)
Returns the cumulative probability of kolmogorov- Parameters:
z-- Returns:
-
gaussInverseCdf
public static double gaussInverseCdf(double p)
Returns the z score of a specific pvalue for Gaussian Partially ported from http://home.online.no/~pjacklam/notes/invnorm/impl/karimov/StatUtil.java Other implementations http://home.online.no/~pjacklam/notes/invnorm/index.html#Java- Parameters:
p-- Returns:
-
chisquareInverseCdf
public static double chisquareInverseCdf(double p, int df)Returns the x score of a specific pvalue and degrees of freedom for Chisquare. It We just do a bisectionsearch for a value within CHI_EPSILON, relying on the monotonicity of chisquareCdf(). Ported from Javascript code posted at http://www.fourmilab.ch/rpkp/experiments/analysis/chiCalc.js- Parameters:
p-df-- Returns:
-
normalQuantile
public static double normalQuantile(double p, double mu, double sigma)Compute the quantile function for the normal distribution. For small to moderate probabilities, algorithm referenced below is used to obtain an initial approximation which is polished with a final Newton step. For very large arguments, an algorithm of Wichura is used. Used by ShapiroWilk Test Ported by Javascript implementation found at https://raw.github.com/rniwa/js-shapiro-wilk/master/shapiro-wilk.js Originally ported from http://svn.r-project.org/R/trunk/src/nmath/qnorm.c- Parameters:
p-mu-sigma-- Returns:
-
dirichletPdf
public static double dirichletPdf(double[] pi, double[] ai)Calculates probability pi, ai under dirichlet distribution- Parameters:
pi- The vector with probabilities.ai- The vector with pseudocounts.- Returns:
- The probability
-
dirichletPdf
public static double dirichletPdf(double[] pi, double a)Implementation for single alpha value.- Parameters:
pi- The vector with probabilities.a- The alpha parameter for all pseudocounts.- Returns:
- The probability
-
multinomialGaussianSample
public static double[] multinomialGaussianSample(double[] mean, double[][] covariance)Samples from Multinomial Normal Distribution.- Parameters:
mean-covariance-- Returns:
- A multinomialGaussianSample from the Multinomial Normal Distribution
-
multinomialGaussianPdf
public static double multinomialGaussianPdf(double[] mean, double[][] covariance, double[] x)Calculates the PDF of Multinomial Normal Distribution for a particular x.- Parameters:
mean-covariance-x- The x record- Returns:
- The multinomialGaussianPdf of x
-
-
DataMelt 3.0 © DataMelt by jWork.ORG