25package umontreal.ssj.probdist;
27import umontreal.ssj.util.*;
28import umontreal.ssj.functions.MathFunction;
49 protected double sigma;
50 private static final double RACPI = 1.7724538509055160273;
52 private static class FunctionInverse
implements MathFunction {
53 private double u, mu, sigma;
55 public FunctionInverse(
double mu,
double sigma,
double u) {
61 public double evaluate(
double x) {
62 return u -
cdf(mu, sigma, x);
78 public double cdf(
double x) {
79 return cdf(mu, sigma, x);
82 public double barF(
double x) {
83 return barF(mu, sigma, x);
110 public static double density(
double mu,
double sigma,
double x) {
112 throw new IllegalArgumentException(
"sigma <= 0");
114 throw new IllegalArgumentException(
"mu < 0");
128 public static double cdf(
double mu,
double sigma,
double x) {
130 throw new IllegalArgumentException(
"sigma <= 0");
132 throw new IllegalArgumentException(
"mu < 0");
146 public static double barF(
double mu,
double sigma,
double x) {
148 throw new IllegalArgumentException(
"sigma <= 0");
150 throw new IllegalArgumentException(
"mu < 0");
164 public static double inverseF(
double mu,
double sigma,
double u) {
166 throw new IllegalArgumentException(
"sigma <= 0");
168 throw new IllegalArgumentException(
"mu < 0");
169 if (u > 1.0 || u < 0.0)
170 throw new IllegalArgumentException(
"u not in [0,1]");
174 return Double.POSITIVE_INFINITY;
190 public static double getMean(
double mu,
double sigma) {
192 throw new IllegalArgumentException(
"sigma <= 0");
194 throw new IllegalArgumentException(
"mu < 0");
196 return sigma *
Num.RAC2 / RACPI * Math.exp(-mu * mu / (2.0 * sigma * sigma))
210 throw new IllegalArgumentException(
"sigma <= 0");
212 throw new IllegalArgumentException(
"mu < 0");
213 double mean = sigma *
Num.RAC2 / RACPI * Math.exp(-mu * mu / (2.0 * sigma * sigma))
215 return mu * mu + sigma * sigma - mean * mean;
239 public static double[]
getMLE(
double[] x,
int n) {
241 throw new IllegalArgumentException(
"n <= 0");
242 throw new UnsupportedOperationException(
"getMLE is not implemented ");
271 throw new IllegalArgumentException(
"sigma <= 0");
273 throw new IllegalArgumentException(
"mu < 0");
285 double[] retour = { mu, sigma };
296 return getClass().getSimpleName() +
" : mu = " + mu +
", sigma = " + sigma;
Classes implementing continuous distributions should inherit from this base class.
String toString()
Returns a String containing information about the current distribution.
static double getMean(double mu, double sigma)
Computes and returns the mean.
static double cdf(double mu, double sigma, double x)
Computes the distribution function.
double getMean()
Returns the mean.
double density(double x)
Returns , the density evaluated at .
static double[] getMLE(double[] x, int n)
NOT IMPLEMENTED.
static double getVariance(double mu, double sigma)
Computes and returns the variance.
double getStandardDeviation()
Returns the standard deviation.
static double density(double mu, double sigma, double x)
Computes the density function of the folded normal distribution.
double inverseF(double u)
Returns the inverse distribution function .
double cdf(double x)
Returns the distribution function .
double getSigma()
Returns the parameter of this object.
void setParams(double mu, double sigma)
Sets the parameters and for this object.
static double getStandardDeviation(double mu, double sigma)
Computes the standard deviation of the folded normal distribution with parameters and .
double[] getParams()
Return a table containing the parameters of the current distribution.
double getMu()
Returns the parameter of this object.
double barF(double x)
Returns the complementary distribution function.
double getVariance()
Returns the variance.
static double barF(double mu, double sigma, double x)
Computes the complementary distribution function.
static double inverseF(double mu, double sigma, double u)
Computes the inverse of the distribution function.
FoldedNormalDist(double mu, double sigma)
Constructs a FoldedNormalDist object with parameters mu and sigma.
Extends the class ContinuousDistribution for the normal distribution (e.g., tjoh95a (page 80)).
double density(double x)
Returns , the density evaluated at .
static double cdf01(double x)
Same as cdf(0, 1, x).
static double barF01(double x)
Same as barF(0, 1, x).
This class provides various constants and methods to compute numerical quantities such as factorials,...
static final double RAC2
The value of .
static double erf(double x)
Returns the value of erf( ), the error function.
This class provides numerical methods to solve non-linear equations.
static double brentDekker(double a, double b, MathFunction f, double tol)
Computes a root of the function in f using the Brent-Dekker method.
This interface should be implemented by classes which represent univariate mathematical functions.