25package umontreal.ssj.probdist;
27import umontreal.ssj.util.Num;
54 protected double alpha;
55 protected double beta;
56 protected double logam;
71 return Math.exp(alpha * Math.log(beta / x) - (beta / x) - logam) / x;
74 public double cdf(
double x) {
75 return cdf(alpha, beta, x);
78 public double barF(
double x) {
79 return barF(alpha, beta, x);
102 public static double density(
double alpha,
double beta,
double x) {
104 throw new IllegalArgumentException(
"alpha <= 0");
106 throw new IllegalArgumentException(
"beta <= 0");
110 return Math.exp(alpha * Math.log(beta / x) - (beta / x) -
Num.
lnGamma(alpha)) / x;
117 public static double cdf(
double alpha,
double beta,
double x) {
119 throw new IllegalArgumentException(
"alpha <= 0");
121 throw new IllegalArgumentException(
"beta <= 0");
132 public static double barF(
double alpha,
double beta,
double x) {
134 throw new IllegalArgumentException(
"alpha <= 0");
136 throw new IllegalArgumentException(
"beta <= 0");
147 public static double inverseF(
double alpha,
double beta,
double u) {
149 throw new IllegalArgumentException(
"alpha <= 0");
151 throw new IllegalArgumentException(
"beta <= 0");
168 public static double[]
getMLE(
double[] x,
int n) {
169 double[] y =
new double[n];
171 for (
int i = 0; i < n; i++) {
191 double parameters[] =
getMLE(x, n);
200 public static double getMean(
double alpha,
double beta) {
202 throw new IllegalArgumentException(
"alpha <= 0");
204 throw new IllegalArgumentException(
"beta <= 0");
206 return (beta / (alpha - 1.0));
216 throw new IllegalArgumentException(
"alpha <= 0");
218 throw new IllegalArgumentException(
"beta <= 0");
220 return ((beta * beta) / ((alpha - 1.0) * (alpha - 1.0) * (alpha - 2.0)));
250 throw new IllegalArgumentException(
"alpha <= 0");
252 throw new IllegalArgumentException(
"beta <= 0");
264 double[] retour = { alpha, beta };
272 return getClass().getSimpleName() +
" : alpha = " + alpha +
", beta = " + beta;
Classes implementing continuous distributions should inherit from this base class.
Extends the class ContinuousDistribution for the gamma distribution tjoh95a (page 337) with shape pa...
double inverseF(double u)
Returns the inverse distribution function .
double cdf(double x)
Returns the distribution function .
static double[] getMLE(double[] x, int n)
Estimates the parameters of the gamma distribution using the maximum likelihood method,...
double barF(double x)
Returns the complementary distribution function.
static double inverseF(double alpha, double beta, double u)
Computes the inverse distribution function of a Pearson V distribution with shape parameter and scal...
double inverseF(double u)
Returns the inverse distribution function .
double density(double x)
Returns , the density evaluated at .
double[] getParams()
Return a table containing the parameters of the current distribution.
void setParam(double alpha, double beta)
Sets the parameters and of this object.
double getVariance()
Returns the variance.
String toString()
Returns a String containing information about the current distribution.
double getAlpha()
Returns the parameter of this object.
static double[] getMLE(double[] x, int n)
Estimates the parameters of the Pearson V distribution using the maximum likelihood method,...
static double cdf(double alpha, double beta, double x)
Computes the density function of a Pearson V distribution with shape parameter and scale parameter .
double getStandardDeviation()
Returns the standard deviation.
static double getVariance(double alpha, double beta)
Computes and returns the variance of a Pearson V distribution with shape parameter and scale param...
static double barF(double alpha, double beta, double x)
Computes the complementary distribution function of a Pearson V distribution with shape parameter an...
Pearson5Dist(double alpha, double beta)
THIS CLASS HAS BEEN RENAMED InverseGammaDist .
double getBeta()
Returns the parameter of this object.
double getMean()
Returns the mean.
static double density(double alpha, double beta, double x)
Computes the density function of a Pearson V distribution with shape parameter and scale parameter .
static double getStandardDeviation(double alpha, double beta)
Computes and returns the standard deviation of a Pearson V distribution with shape parameter and sca...
double barF(double x)
Returns the complementary distribution function.
static double getMean(double alpha, double beta)
Computes and returns the mean of a Pearson V distribution with shape parameter and scale parameter ...
double cdf(double x)
Returns the distribution function .
static Pearson5Dist getInstanceFromMLE(double[] x, int n)
Creates a new instance of a Pearson V distribution with parameters.
This class provides various constants and methods to compute numerical quantities such as factorials,...
static double lnGamma(double x)
Returns the natural logarithm of the gamma function evaluated at x.