25package umontreal.ssj.probdist;
61 public static double density(
int k,
double lambda,
double x) {
62 return density((
double) k, lambda, x);
68 public static double cdf(
int k,
double lambda,
int d,
double x) {
69 return cdf((
double) k, d, lambda * x);
75 public static double barF(
int k,
double lambda,
int d,
double x) {
76 return barF((
double) k, d, lambda * x);
82 public static double inverseF(
int k,
double lambda,
int d,
double u) {
83 return inverseF((
double) k, lambda, d, u);
101 public static double[]
getMLE(
double[] x,
int n) {
102 double parameters[] =
GammaDist.getMLE(x, n);
103 parameters[0] = Math.round(parameters[0]);
116 double parameters[] =
getMLE(x, n);
117 return new ErlangDist((
int) parameters[0], parameters[1]);
126 public static double getMean(
int k,
double lambda) {
128 throw new IllegalArgumentException(
"k <= 0");
130 throw new IllegalArgumentException(
"lambda <= 0");
143 throw new IllegalArgumentException(
"k <= 0");
145 throw new IllegalArgumentException(
"lambda <= 0");
147 return (k / (lambda * lambda));
158 throw new IllegalArgumentException(
"k <= 0");
160 throw new IllegalArgumentException(
"lambda <= 0");
162 return (Math.sqrt(k) / lambda);
178 super.setParams(k, lambda, d);
186 return super.getParams();
193 return getClass().getSimpleName() +
" : k = " + (int) super.getAlpha() +
", lambda = " + super.getLambda();
ErlangDist(int k, double lambda)
Constructs a ErlangDist object with parameters = k and.
static double density(int k, double lambda, double x)
Computes the density function.
static double[] getMLE(double[] x, int n)
Estimates the parameters of the Erlang distribution using the maximum likelihood method,...
static ErlangDist getInstanceFromMLE(double[] x, int n)
Creates a new instance of an Erlang distribution with parameters.
static double barF(int k, double lambda, int d, double x)
Computes the complementary distribution function.
ErlangDist(int k)
Constructs a ErlangDist object with parameters = k and .
static double inverseF(int k, double lambda, int d, double u)
Returns the inverse distribution function.
int getK()
Returns the parameter for this object.
static double getStandardDeviation(int k, double lambda)
Computes and returns the standard deviation of the Erlang distribution with parameters and .
static double getMean(int k, double lambda)
Computes and returns the mean, , of the Erlang distribution with parameters and .
String toString()
Returns a String containing information about the current distribution.
double[] getParams()
Return a table containing parameters of the current distribution.
static double cdf(int k, double lambda, int d, double x)
Computes the distribution function using the gamma distribution function.
static double getVariance(int k, double lambda)
Computes and returns the variance, , of the Erlang distribution with parameters and .
void setParams(int k, double lambda, int d)
Sets the parameters and of the distribution for this object.
GammaDist(double alpha)
Constructs a GammaDist object with parameters = alpha and .
double getAlpha()
Return the parameter for this object.