javanpst.distributions.common.continuous
Class NormalDistribution
- java.lang.Object
-
- javanpst.distributions.common.continuous.NormalDistribution
-
- All Implemented Interfaces:
- Distribution
public class NormalDistribution extends java.lang.Object implements Distribution
A Normal distribution.
-
-
Constructor Summary
Constructors Constructor and Description NormalDistribution()Default builder.NormalDistribution(double mean, double sigma)Builder.NormalDistribution(NormalDistribution old)Copy constructor Creates a copy of a given Normal distribution
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublecomputeCumulativeProbability(double x)Computes cumulative probability at a given point of the Normal distribution.doublecomputeProbability(double x)Computes mass probability at a given point of the Normal distribution.doublegetMean()Gets the mean parameterdoublegetSigma()Gets the sigma parameterdoublegetTipifiedProbability(double z, boolean upper)Computes cumulative N(0,1) distribution.doubleinverseNormalDistribution(double p)Computes inverse normal distribution value (N[0,1]).voidsetMean(double value)Sets meanvoidsetS(double value)Sets sigma Sigma value must be positivejava.lang.StringtoString()To String method.
-
-
-
Constructor Detail
-
NormalDistribution
public NormalDistribution()
Default builder. Creates a Normal distribution with parameters mean = 0 and sigma = 1
-
NormalDistribution
public NormalDistribution(double mean, double sigma)Builder. Creates a Normal distribution with the specified parameters Sigma must be positive- Parameters:
mean- mean of the distributionsigma- standard deviation
-
NormalDistribution
public NormalDistribution(NormalDistribution old)
Copy constructor Creates a copy of a given Normal distribution- Parameters:
old- Normal distribution to copy
-
-
Method Detail
-
setMean
public void setMean(double value)
Sets mean- Parameters:
value- mean value
-
setS
public void setS(double value)
Sets sigma Sigma value must be positive- Parameters:
value- sigma value
-
getMean
public double getMean()
Gets the mean parameter- Returns:
- value of mean
-
getSigma
public double getSigma()
Gets the sigma parameter- Returns:
- value of sigma
-
computeProbability
public double computeProbability(double x)
Computes mass probability at a given point of the Normal distribution.- Specified by:
computeProbabilityin interfaceDistribution- Parameters:
x- point selected- Returns:
- mass probability at 'x'
-
computeCumulativeProbability
public double computeCumulativeProbability(double x)
Computes cumulative probability at a given point of the Normal distribution.- Specified by:
computeCumulativeProbabilityin interfaceDistribution- Parameters:
x- point selected- Returns:
- cumulative probability at 'x'
-
getTipifiedProbability
public double getTipifiedProbability(double z, boolean upper)Computes cumulative N(0,1) distribution. Based on Algorithm AS66 Applied Statistics (1973) vol 22 no.3- Parameters:
z- x valueupper- A boolean value, if true the integral is evaluated from z to infinity, from minus infinity to z otherwise- Returns:
- The value of the cumulative N(0,1) distribution for z
-
inverseNormalDistribution
public double inverseNormalDistribution(double p)
Computes inverse normal distribution value (N[0,1]). Error is bounded to 1.15E-09. Based on http://home.online.no/~pjacklam/notes/invnorm/- Parameters:
p- probability value- Returns:
- z value associated to p
- See Also:
- "http://home.online.no/~pjacklam/notes/invnorm/"
-
toString
public java.lang.String toString()
To String method.- Overrides:
toStringin classjava.lang.Object- Returns:
- string representation of the distribution
-
-
DMelt 3.0 © DataMelt by jWork.ORG