Class DistNormalTrunc
java.lang.Object
nl.tudelft.simulation.jstats.distributions.Dist
nl.tudelft.simulation.jstats.distributions.DistContinuous
nl.tudelft.simulation.jstats.distributions.DistNormalTrunc
- All Implemented Interfaces:
Serializable
The Normal Truncated distribution. For more information on the truncated normal distribution see https://en.wikipedia.org/wiki/Truncated_normal_distribution
This version of the normal distribution uses the numerically approached inverse cumulative distribution.
(c) copyright 2002-2021 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: Lesser General Public License (LGPL) , no warranty.
- Author:
- Alexander Verbraeck
Wouter Schakel - See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDistNormalTrunc
(StreamInterface stream, double min, double max) constructs a normal distribution with mu=0 and sigma=1.DistNormalTrunc
(StreamInterface stream, double mu, double sigma, double min, double max) constructs a normal distribution with mu and sigma. -
Method Summary
Modifier and TypeMethodDescriptiondouble
draw()
draws the next stream value according to the probability of this this distribution.double
getCumulativeProbability
(double x) returns the cumulative probability of the x-value.double
getInverseCumulativeProbability
(double cumulativeProbability) returns the x-value of the given cumulativePropability.double
getMax()
double
getMin()
double
getMu()
double
getProbabilityDensity
(double x) returns the probability density value of a value x.double
getSigma()
toString()
-
Constructor Details
-
DistNormalTrunc
constructs a normal distribution with mu=0 and sigma=1. Errors of various types, e.g., in the impact point of a bomb; quantities that are the sum of a large number of other quantities by the virtue of the central limit theorem.- Parameters:
stream
- StreamInterface; the numberstreammin
- double; minimum x-value of the distributionmax
- double; maximum x-value of the distribution
-
DistNormalTrunc
constructs a normal distribution with mu and sigma.- Parameters:
stream
- StreamInterface; the random number streammu
- double; the meansigma
- double; the standard deviationmin
- double; minimum x-value of the distributionmax
- double; maximum x-value of the distribution- Throws:
IllegalArgumentException
- when sigma <= 0 or when max <= min, or when the probabilities are so small that drawing becomes impossible. The cutoff point is at an interval with an overall probability of less than 1E-6
-
-
Method Details
-
draw
public double draw()draws the next stream value according to the probability of this this distribution.- Specified by:
draw
in classDistContinuous
- Returns:
- the next double value drawn.
-
getCumulativeProbability
public double getCumulativeProbability(double x) returns the cumulative probability of the x-value.- Parameters:
x
- double; the observation x- Returns:
- double the cumulative probability
-
getInverseCumulativeProbability
public double getInverseCumulativeProbability(double cumulativeProbability) returns the x-value of the given cumulativePropability.- Parameters:
cumulativeProbability
- double; reflects cum prob- Returns:
- double the inverse cumulative probability
-
getProbabilityDensity
public double getProbabilityDensity(double x) returns the probability density value of a value x.- Specified by:
getProbabilityDensity
in classDistContinuous
- Parameters:
x
- double; the value for which the density function needs to be calculated- Returns:
- double; the probability density for value x
-
getMu
public double getMu()- Returns:
- mu
-
getSigma
public double getSigma()- Returns:
- sigma
-
getMin
public double getMin()- Returns:
- min
-
getMax
public double getMax()- Returns:
- max
-
toString
-