public class NormalDist extends NaryFunction
Works like Excel's NORMDIST function
normdist(X,mu,sd)
calculates the cumulative probability p(x < X) with mean mu and standard deviation sd.
A four argument form normdist(x,mu,sd,0)
gives the pdf.
The algorithm for the cdf has come from George Marsaglia Evaluating the Normal Distribution Journal of Statistical Software, Vol 11, issue 4, 2004, https://www.jstatsoft.org/article/view/v011i04
It is accurate to about 1e15 or 1e16. For greater accuracy try the Apache Common Math Library http://commons.apache.org/proper/commons-math/.
Modifier and Type | Class and Description |
---|---|
static class |
NormalDist.Type
Type of dictributuion to calculate PDF/CDF
|
curNumberOfParameters, name, NaN, numberOfParameters
Constructor and Description |
---|
NormalDist(NormalDist.Type type)
Constructor
|
Modifier and Type | Method and Description |
---|---|
static double |
cdf(double x,
double mu,
double sigma)
Cdf with given mean and standard deviation
|
java.lang.Object |
eval(java.lang.Object[] args)
Evaluate the function
|
static double |
pdf(double x,
double mu,
double sigma)
PDF with given mean and standard deviation
|
static double |
phi(double z)
Standardised normal pdf with mean 0 and sd 1.
|
static double |
Phi(double z)
Standardised normal pdf with mean 0 and sd 1.
|
run
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, checkNumberOfParameters, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString, toString
public NormalDist(NormalDist.Type type)
type
- the mode for the distribution pdf/cdf/ fourarg version.public java.lang.Object eval(java.lang.Object[] args) throws EvaluationException
NaryFunction
eval
in class NaryFunction
args
- arguments to the functionEvaluationException
- if the calculation cannot be performedpublic static double pdf(double x, double mu, double sigma)
x
- value to testmu
- meansigma
- standard deviationpublic static double phi(double z)
z
- z-statisticpublic static double cdf(double x, double mu, double sigma)
x
- test valuemu
- meansigma
- standard deviationpublic static double Phi(double z)
z
- z-value to testCopyright © 2018 Singular Systems http://www.singularsys.com/jep