25package umontreal.ssj.probdist;
27import umontreal.ssj.util.Num;
71 public double cdf(
double x) {
72 return cdf(alpha, beta, x);
75 public double barF(
double x) {
76 return barF(alpha, beta, x);
92 return ParetoDist.getStandardDeviation(alpha, beta);
98 public static double density(
double alpha,
double beta,
double x) {
100 throw new IllegalArgumentException(
"alpha <= 0");
102 throw new IllegalArgumentException(
"beta <= 0");
104 return x < beta ? 0 : alpha * Math.pow(beta / x, alpha) / x;
110 public static double cdf(
double alpha,
double beta,
double x) {
112 throw new IllegalArgumentException(
"alpha <= 0");
114 throw new IllegalArgumentException(
"beta <= 0");
117 return 1.0 - Math.pow(beta / x, alpha);
123 public static double barF(
double alpha,
double beta,
double x) {
125 throw new IllegalArgumentException(
"c <= 0");
127 throw new IllegalArgumentException(
"beta <= 0");
130 return Math.pow(beta / x, alpha);
136 public static double inverseF(
double alpha,
double beta,
double u) {
138 throw new IllegalArgumentException(
"c <= 0");
140 throw new IllegalArgumentException(
"beta <= 0");
142 if (u < 0.0 || u > 1.0)
143 throw new IllegalArgumentException(
"u not in [0,1]");
151 return Double.POSITIVE_INFINITY;
153 return beta / Math.pow(1 - u, 1.0 / alpha);
173 public static double[]
getMLE(
double[] x,
int n) {
175 throw new IllegalArgumentException(
"n <= 0");
177 double[] parameters =
new double[2];
178 parameters[1] = Double.POSITIVE_INFINITY;
179 for (
int i = 0; i < n; i++) {
180 if (x[i] < parameters[1])
181 parameters[1] = x[i];
185 for (
int i = 0; i < n; i++) {
187 sum += Math.log(x[i] / parameters[1]);
191 parameters[0] = n / sum;
205 double parameters[] =
getMLE(x, n);
206 return new ParetoDist(parameters[0], parameters[1]);
215 public static double getMean(
double alpha,
double beta) {
217 throw new IllegalArgumentException(
"alpha <= 1");
219 throw new IllegalArgumentException(
"beta <= 0");
221 return ((alpha * beta) / (alpha - 1.0));
234 throw new IllegalArgumentException(
"alpha <= 2");
236 throw new IllegalArgumentException(
"beta <= 0");
238 return ((alpha * beta * beta) / ((alpha - 2.0) * (alpha - 1.0) * (alpha - 1.0)));
248 return Math.sqrt(
ParetoDist.getVariance(alpha, beta));
270 throw new IllegalArgumentException(
"alpha <= 0");
272 throw new IllegalArgumentException(
"beta <= 0");
284 double[] retour = { alpha, beta };
292 return getClass().getSimpleName() +
" : alpha = " + alpha +
", beta = " + beta;
Classes implementing continuous distributions should inherit from this base class.
static double barF(double alpha, double beta, double x)
Computes the complementary distribution function.
double getStandardDeviation()
Returns the standard deviation.
double getAlpha()
Returns the parameter .
double barF(double x)
Returns the complementary distribution function.
static ParetoDist getInstanceFromMLE(double[] x, int n)
Creates a new instance of a Pareto distribution with parameters.
double density(double x)
Returns , the density evaluated at .
double cdf(double x)
Returns the distribution function .
static double inverseF(double alpha, double beta, double u)
Computes the inverse of the distribution function.
double inverseF(double u)
Returns the inverse distribution function .
double getVariance()
Returns the variance.
static double[] getMLE(double[] x, int n)
Estimates the parameters of the Pareto distribution using the maximum likelihood method,...
static double getMean(double alpha, double beta)
Computes and returns the mean of the Pareto distribution with parameters and.
static double cdf(double alpha, double beta, double x)
Computes the distribution function.
double getMean()
Returns the mean.
ParetoDist(double alpha, double beta)
Constructs a ParetoDist object with parameters alpha and beta.
void setParams(double alpha, double beta)
Sets the parameter and for this object.
static double getStandardDeviation(double alpha, double beta)
Computes and returns the standard deviation of the Pareto distribution with parameters and .
ParetoDist(double alpha)
Constructs a ParetoDist object with parameters alpha and .
static double density(double alpha, double beta, double x)
Computes the density function.
static double getVariance(double alpha, double beta)
Computes and returns the variance.
String toString()
Returns a String containing information about the current distribution.
double[] getParams()
Return a table containing the parameters of the current distribution.
double getBeta()
Returns the parameter .
This class provides various constants and methods to compute numerical quantities such as factorials,...
static final int DBL_MAX_10_EXP
Largest int such that is representable (approximately) as a double.