@Alias(value={"GaussianDistribution","normal","gauss"}) public class NormalDistribution extends AbstractDistribution
Modifier and Type | Class and Description |
---|---|
static class |
NormalDistribution.Parameterizer
Parameterization class
|
Modifier and Type | Field and Description |
---|---|
(package private) static double[] |
ERFAPP_A
Coefficients for erf approximation.
|
(package private) static double[] |
ERFAPP_B
Coefficients for erf approximation.
|
(package private) static double[] |
ERFAPP_C
Coefficients for erf approximation.
|
(package private) static double[] |
ERFAPP_D
Coefficients for erf approximation.
|
(package private) static double[] |
ERFAPP_P
Coefficients for erf approximation.
|
(package private) static double[] |
ERFAPP_Q
Coefficients for erf approximation.
|
(package private) static double[] |
ERFINV_A
Coefficients for erfinv approximation, rational version
|
(package private) static double[] |
ERFINV_B
Coefficients for erfinv approximation, rational version
|
(package private) static double[] |
ERFINV_C
Coefficients for erfinv approximation, rational version
|
(package private) static double[] |
ERFINV_D
Coefficients for erfinv approximation, rational version
|
private double |
mean
Mean value for the generator
|
static double |
ONEBYPHIINV075
1 / CDFINV(0.75)
|
(package private) static double |
P_HIGH
Treshold for switching nethods for erfinv approximation
|
(package private) static double |
P_LOW
Treshold for switching nethods for erfinv approximation
|
private double |
stddev
Standard deviation
|
random
Constructor and Description |
---|
NormalDistribution(double mean,
double stddev)
Constructor for Gaussian distribution
|
NormalDistribution(double mean,
double stddev,
Random random)
Constructor for Gaussian distribution
|
NormalDistribution(double mean,
double stddev,
RandomFactory random)
Constructor for Gaussian distribution
|
Modifier and Type | Method and Description |
---|---|
double |
cdf(double val)
Return the cumulative density function at the given value.
|
static double |
cdf(double x,
double mu,
double sigma)
Cumulative probability density function (CDF) of a normal distribution.
|
static double |
erf(double x)
Error function for Gaussian distributions = Normal distributions.
|
static double |
erfc(double x)
Complementary error function for Gaussian distributions = Normal
distributions.
|
static double |
erfinv(double x)
Inverse error function.
|
double |
getMean() |
double |
getStddev() |
double |
nextRandom()
Generate a new random value
|
double |
pdf(double val)
Return the density of an existing value
|
static double |
pdf(double x,
double mu,
double sigma)
Probability density function of the normal distribution.
|
double |
quantile(double q)
Quantile aka probit (for normal) aka inverse CDF (invcdf, cdf^-1) function.
|
static double |
quantile(double x,
double mu,
double sigma)
Inverse cumulative probability density function (probit) of a normal
distribution.
|
static double |
standardNormalCDF(double x)
Cumulative probability density function (CDF) of a normal distribution.
|
static double |
standardNormalPDF(double x)
Probability density function of the normal distribution.
|
static double |
standardNormalQuantile(double d)
Approximate the inverse error function for normal distributions.
|
String |
toString()
Describe the distribution
|
static final double[] ERFAPP_A
static final double[] ERFAPP_B
static final double[] ERFAPP_C
static final double[] ERFAPP_D
static final double[] ERFAPP_P
static final double[] ERFAPP_Q
static final double P_LOW
static final double P_HIGH
static final double[] ERFINV_A
static final double[] ERFINV_B
static final double[] ERFINV_C
static final double[] ERFINV_D
public static final double ONEBYPHIINV075
private double mean
private double stddev
public NormalDistribution(double mean, double stddev, RandomFactory random)
mean
- Meanstddev
- Standard Deviationrandom
- Random generatorpublic NormalDistribution(double mean, double stddev, Random random)
mean
- Meanstddev
- Standard Deviationrandom
- Random generatorpublic NormalDistribution(double mean, double stddev)
mean
- Meanstddev
- Standard Deviationpublic double pdf(double val)
Distribution
val
- existing valuepublic double cdf(double val)
Distribution
val
- existing valuepublic double quantile(double q)
Distribution
q
- Quantile to findpublic double nextRandom()
Distribution
nextRandom
in interface Distribution
nextRandom
in class AbstractDistribution
public String toString()
Distribution
toString
in interface Distribution
toString
in class Object
public double getMean()
public double getStddev()
public static double erfc(double x)
x
- parameter valuepublic static double erf(double x)
x
- parameter valuepublic static double erfinv(double x)
x
- parameter valuepublic static double pdf(double x, double mu, double sigma)
1/(SQRT(2*pi*sigma^2)) * e^(-(x-mu)^2/2sigma^2)
x
- The value.mu
- The mean.sigma
- The standard deviation.public static double standardNormalPDF(double x)
1/(SQRT(2*pi*sigma^2)) * e^(-(x-mu)^2/2sigma^2)
x
- The value.public static double cdf(double x, double mu, double sigma)
x
- value to evaluate CDF atmu
- Mean valuesigma
- Standard deviation.public static double standardNormalCDF(double x)
x
- value to evaluate CDF atpublic static double quantile(double x, double mu, double sigma)
x
- value to evaluate probit function atmu
- Mean valuesigma
- Standard deviation.public static double standardNormalQuantile(double d)
http://www.math.uio.no/~jacklam/notes/invnorm/index.html
by Peter John Acklam
d
- Quantile. Must be in [0:1], obviously.