Class NormalDist
- java.lang.Object
-
- com.singularsys.jep.functions.PostfixMathCommand
-
- com.singularsys.jep.functions.NaryFunction
-
- com.singularsys.extensions.statistical.distributions.NormalDist
-
- All Implemented Interfaces:
PostfixMathCommandI,java.io.Serializable
public class NormalDist extends NaryFunction
The normal distribution function.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 formnormdist(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/.
- Author:
- rich
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classNormalDist.TypeType of dictributuion to calculate PDF/CDF
-
Field Summary
-
Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, name, NaN, numberOfParameters
-
-
Constructor Summary
Constructors Constructor Description NormalDist(NormalDist.Type type)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static doublecdf(double x, double mu, double sigma)Cdf with given mean and standard deviationjava.lang.Objecteval(java.lang.Object[] args)Evaluate the functionstatic doublepdf(double x, double mu, double sigma)PDF with given mean and standard deviationstatic doublephi(double z)Standardised normal pdf with mean 0 and sd 1.static doublePhi(double z)Standardised normal pdf with mean 0 and sd 1.-
Methods inherited from class com.singularsys.jep.functions.NaryFunction
run
-
Methods inherited from class com.singularsys.jep.functions.PostfixMathCommand
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, checkNumberOfParameters, getName, getNumberOfParameters, setCurNumberOfParameters, setName, toString, toString
-
-
-
-
Constructor Detail
-
NormalDist
public NormalDist(NormalDist.Type type)
Constructor- Parameters:
type- the mode for the distribution pdf/cdf/ fourarg version.
-
-
Method Detail
-
eval
public java.lang.Object eval(java.lang.Object[] args) throws EvaluationExceptionDescription copied from class:NaryFunctionEvaluate the function- Specified by:
evalin classNaryFunction- Parameters:
args- arguments to the function- Returns:
- value returned by the function
- Throws:
EvaluationException- if the calculation cannot be performed
-
pdf
public static double pdf(double x, double mu, double sigma)PDF with given mean and standard deviation- Parameters:
x- value to testmu- meansigma- standard deviation- Returns:
-
phi
public static double phi(double z)
Standardised normal pdf with mean 0 and sd 1.- Parameters:
z- z-statistic- Returns:
- φ(z)
-
cdf
public static double cdf(double x, double mu, double sigma)Cdf with given mean and standard deviation- Parameters:
x- test valuemu- meansigma- standard deviation- Returns:
- cdf
-
Phi
public static double Phi(double z)
Standardised normal pdf with mean 0 and sd 1.- Parameters:
z- z-value to test- Returns:
- Φ(z)
-
-