25package umontreal.ssj.probdist;
27import umontreal.ssj.util.Num;
72 public double cdf(
double x) {
73 return cdf(a, beta, x);
76 public double barF(
double x) {
77 return barF(a, beta, x);
105 public static double density(
double a,
double beta,
double x) {
107 throw new IllegalArgumentException(
"beta <= 0");
110 final double Z = (x - a) / beta;
111 return Z / beta * Math.exp(-Z * Z / 2.0);
121 public static double density(
double beta,
double x) {
134 public static double cdf(
double a,
double beta,
double x) {
136 throw new IllegalArgumentException(
"beta <= 0");
139 final double Z = (x - a) / beta;
142 return -Math.expm1(-Z * Z / 2.0);
152 public static double cdf(
double beta,
double x) {
153 return cdf(0.0, beta, x);
164 public static double barF(
double a,
double beta,
double x) {
166 throw new IllegalArgumentException(
"beta <= 0");
169 double z = (x - a) / beta;
172 return Math.exp(-z * z / 2.0);
182 public static double barF(
double beta,
double x) {
183 return barF(0.0, beta, x);
195 public static double inverseF(
double a,
double beta,
double u) {
197 throw new IllegalArgumentException(
"beta <= 0");
198 if (u < 0.0 || u > 1.0)
199 throw new IllegalArgumentException(
"u not in [0, 1]");
203 return Double.POSITIVE_INFINITY;
205 return a + beta * Math.sqrt(-2.0 * Math.log1p(-u));
215 public static double inverseF(
double beta,
double u) {
233 public static double[]
getMLE(
double[] x,
int n,
double a) {
235 throw new IllegalArgumentException(
"n <= 0");
238 for (
int i = 0; i < n; ++i)
239 somme += (x[i] - a) * (x[i] - a);
241 double[] parametres =
new double[1];
242 parametres[0] = Math.sqrt(somme / (2.0 * n));
257 double parameters[] =
getMLE(x, n, a);
269 public static double getMean(
double a,
double beta) {
271 throw new IllegalArgumentException(
"beta <= 0");
272 return (a + beta * Math.sqrt(Math.PI / 2.0));
283 throw new IllegalArgumentException(
"beta = 0");
284 return (2.0 - 0.5 * Math.PI) * beta * beta;
324 throw new IllegalArgumentException(
"beta <= 0");
337 double[] retour = { a, beta };
347 return getClass().getSimpleName() +
" : a = " + a +
", beta = " + beta;
Classes implementing continuous distributions should inherit from this base class.
static double inverseF(double beta, double u)
Same as inverseF (0, beta, u).
RayleighDist(double a, double beta)
Constructs a RayleighDist object with parameters a, and = beta.
static RayleighDist getInstanceFromMLE(double[] x, int n, double a)
Creates a new instance of a Rayleigh distribution with parameters.
static double barF(double beta, double x)
Same as barF (0, beta, x).
static double[] getMLE(double[] x, int n, double a)
Estimates the parameter of the Rayleigh distribution using the maximum likelihood method,...
void setParams(double a, double beta)
Sets the parameters and for this object.
String toString()
Returns a String containing information about the current distribution.
double getStandardDeviation()
Returns the standard deviation.
double barF(double x)
Returns the complementary distribution function.
static double getVariance(double beta)
Returns the variance of the Rayleigh distribution with parameter.
RayleighDist(double beta)
Constructs a RayleighDist object with parameters and.
double getMean()
Returns the mean.
static double density(double beta, double x)
Same as density (0, beta, x).
double density(double x)
Returns , the density evaluated at .
static double density(double a, double beta, double x)
Computes the density function ( frayleigh ).
static double inverseF(double a, double beta, double u)
Computes the inverse of the distribution function ( Invrayleigh ).
static double barF(double a, double beta, double x)
Computes the complementary distribution function.
static double getMean(double a, double beta)
Returns the mean of the Rayleigh distribution with parameters and .
static double getStandardDeviation(double beta)
Returns the standard deviation of the Rayleigh distribution with parameter .
static double cdf(double beta, double x)
Same as cdf (0, beta, x).
double getA()
Returns the parameter .
double getVariance()
Returns the variance.
static double cdf(double a, double beta, double x)
Computes the distribution function ( Frayleigh ).
double[] getParams()
Return an array containing the parameters of the current distribution in the order: [ ,...
double getSigma()
Returns the parameter .
double cdf(double x)
Returns the distribution function .
double inverseF(double u)
Returns the inverse distribution function .