25package umontreal.ssj.probdist;
27import umontreal.ssj.util.Num;
79 public double cdf(
double x) {
80 return cdf(a, b, c, x);
83 public double barF(
double x) {
84 return barF(a, b, c, x);
100 return PowerDist.getStandardDeviation(a, b, c);
113 public static double density(
double a,
double b,
double c,
double x) {
115 throw new IllegalArgumentException(
"c <= 0");
120 double z = (x - a) / (b - a);
121 return c * Math.pow(z, c - 1.0) / (b - a);
134 public static double cdf(
double a,
double b,
double c,
double x) {
136 throw new IllegalArgumentException(
"c <= 0");
141 return Math.pow((x - a) / (b - a), c);
153 public static double barF(
double a,
double b,
double c,
double x) {
155 throw new IllegalArgumentException(
"c <= 0");
160 return 1.0 - Math.pow((x - a) / (b - a), c);
172 public static double inverseF(
double a,
double b,
double c,
double u) {
174 throw new IllegalArgumentException(
"c <= 0");
175 if (u < 0.0 || u > 1.0)
176 throw new IllegalArgumentException(
"u not in [0, 1]");
182 return a + (b - a) * Math.pow(u, 1.0 / c);
202 public static double[]
getMLE(
double[] x,
int n,
double a,
double b) {
204 throw new IllegalArgumentException(
"n <= 0");
208 for (
int i = 0; i < n; ++i)
209 somme += Math.log((x[i] - a) / d);
211 double[] parametres =
new double[1];
212 parametres[0] = -1.0 / (somme / n);
228 double parameters[] =
getMLE(x, n, a, b);
229 return new PowerDist(a, b, parameters[0]);
241 public static double getMean(
double a,
double b,
double c) {
242 return a + (b - a) * c / (c + 1.0);
255 return (b - a) * (b - a) * c / ((c + 1.0) * (c + 1.0) * (c + 2.0));
265 return Math.sqrt(
PowerDist.getVariance(a, b, c));
315 double[] retour = { a, b, c };
325 return getClass().getSimpleName() +
" : a = " + a +
" : b = " + b +
" : c = " + c;
Classes implementing continuous distributions should inherit from this base class.
static double barF(double a, double b, double c, double x)
Computes the complementary distribution function.
static double getVariance(double a, double b, double c)
Computes and returns the variance of the power distribution with parameters , and.
PowerDist(double c)
Constructs a PowerDist object with parameters , and c.
static double cdf(double a, double b, double c, double x)
Computes the distribution function ( Fpower ).
double getA()
Returns the parameter .
static PowerDist getInstanceFromMLE(double[] x, int n, double a, double b)
Creates a new instance of a power distribution with parameters.
static double getMean(double a, double b, double c)
Returns the mean of the power distribution with parameters , and .
static double density(double a, double b, double c, double x)
Computes the density function ( fpower ).
String toString()
Returns a String containing information about the current distribution.
double getMean()
Returns the mean.
double inverseF(double u)
Returns the inverse distribution function .
double getStandardDeviation()
Returns the standard deviation.
double getC()
Returns the parameter .
double getB()
Returns the parameter .
PowerDist(double a, double b, double c)
Constructs a PowerDist object with parameters a, b and c.
double cdf(double x)
Returns the distribution function .
void setParams(double a, double b, double c)
Sets the parameters , and for this object.
double density(double x)
Returns , the density evaluated at .
static double getStandardDeviation(double a, double b, double c)
Computes and returns the standard deviation of the power distribution with parameters ,...
PowerDist(double b, double c)
Constructs a PowerDist object with parameters , b and c.
static double[] getMLE(double[] x, int n, double a, double b)
Estimates the parameter of the power distribution from the.
static double inverseF(double a, double b, double c, double u)
Computes the inverse of the distribution function.
double[] getParams()
Return a table containing the parameters of the current distribution.
double getVariance()
Returns the variance.
double barF(double x)
Returns the complementary distribution function.