
public class NormalDistribution extends Object implements DistributionWithRandom
| 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
|
(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 Random |
random
The random generator.
|
private double |
stddev
Standard deviation
|
| Constructor and Description |
|---|
NormalDistribution(double mean,
double stddev)
Constructor for Gaussian distribution
|
NormalDistribution(double mean,
double stddev,
Random 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 |
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
private double mean
private double stddev
private Random random
public 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)
Distributionpdf in interface Distributionval - existing valuepublic double cdf(double val)
Distributioncdf in interface Distributionval - existing valuepublic double quantile(double q)
Distributionquantile in interface Distributionq - Quantile to findpublic double nextRandom()
DistributionWithRandomnextRandom in interface DistributionWithRandompublic String toString()
DistributiontoString in interface DistributiontoString in class Objectpublic 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 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.public 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 cdf(double x,
double mu,
double sigma)
x - value to evaluate CDF atmu - Mean valuesigma - Standard deviation.public static double quantile(double x,
double mu,
double sigma)
x - value to evaluate probit function atmu - Mean valuesigma - Standard deviation.