Class DistNormal
java.lang.Object
nl.tudelft.simulation.jstats.distributions.Dist
nl.tudelft.simulation.jstats.distributions.DistContinuous
nl.tudelft.simulation.jstats.distributions.DistNormal
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
DistLogNormal
The Normal distribution. For more information on this distribution see
https://mathworld.wolfram.com/NormalDistribution.html
Copyright (c) 2002-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://https://simulation.tudelft.nl/dsol/docs/latest/license.html.
- Author:
- Peter Jacobs , Alexander Verbraeck
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
haveNextNextGaussian is a helper attribute.double
mu refers to the mean of the normal distribution.double
sigma refers to the standard deviation of the normal distribution. -
Constructor Summary
ConstructorDescriptionDistNormal
(StreamInterface stream) constructs a standard normal distribution with mu=0 and sigma=1.DistNormal
(StreamInterface stream, double mu, double sigma) constructs a normal distribution with provided 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
getMu()
double
getProbabilityDensity
(double x) returns the probability density value of a value x.double
getSigma()
protected double
Generates the next pseudorandom, Gaussian (normally) distributed double value, with mean 0.0 and standard deviation 1.0 see section 3.4.1 of The Art of Computer Programming, Volume 2 by Donald Knuth.void
setStream
(StreamInterface stream) Replace the random number stream.toString()
-
Field Details
-
mu
public double mumu refers to the mean of the normal distribution. -
sigma
public double sigmasigma refers to the standard deviation of the normal distribution. -
haveNextNextGaussian
protected boolean haveNextNextGaussianhaveNextNextGaussian is a helper attribute.
-
-
Constructor Details
-
DistNormal
constructs a standard normal distribution with mu=0 and sigma=1. Models probabilities that are the sum of a large number of other probabilities by the virtue of the central limit theorem.- Parameters:
stream
- StreamInterface; the random number stream
-
DistNormal
constructs a normal distribution with provided mu and sigma.- Parameters:
stream
- StreamInterface; the random number streammu
- double; the meansigma
- double; the standard deviation- Throws:
IllegalArgumentException
- when sigma <= 0
-
-
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
-
nextGaussian
protected double nextGaussian()Generates the next pseudorandom, Gaussian (normally) distributed double value, with mean 0.0 and standard deviation 1.0 see section 3.4.1 of The Art of Computer Programming, Volume 2 by Donald Knuth.- Returns:
- double the next Gaussian value
-
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
-
setStream
Replace the random number stream. -
toString
-