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,Serializable
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 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/.
- Author:
- rich
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumType of distribution to calculate PDF/CDF -
Field Summary
Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand
curNumberOfParameters, description, name, NaN, numberOfParameters -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doublecdf(double x, double mu, double sigma) Cdf with given mean and standard deviationEvaluate 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
runMethods inherited from class com.singularsys.jep.functions.PostfixMathCommand
asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, asType, checkNumberOfParameters, getDescription, getDescription, getDescriptionWithType, getName, getNumberOfParameters, setCurNumberOfParameters, setDescription, setName, toString, toString
-
Constructor Details
-
NormalDist
Constructor- Parameters:
type- the mode for the distribution pdf/cdf/ fourarg version.
-
-
Method Details
-
eval
Description 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)
-