25package umontreal.ssj.probdist;
51 if (p < 0.0 || p > 1.0)
52 throw new IllegalArgumentException(
"p not in [0,1]");
59 public double prob(
int x) {
67 public double cdf(
int x) {
75 public double barF(
int x) {
84 if (u < 0.0 || u > 1.0)
85 throw new IllegalArgumentException(
"u not in [0,1]");
107 public static double prob(
double p,
int x) {
108 if (p < 0.0 || p > 1.0)
109 throw new IllegalArgumentException(
"p not in [0,1]");
122 public static double cdf(
double p,
int x) {
123 if (p < 0.0 | p > 1.0)
124 throw new IllegalArgumentException(
"p not in [0,1]");
137 public static double barF(
double p,
int x) {
138 if (p < 0.0 | p > 1.0)
139 throw new IllegalArgumentException(
"p not in [0,1]");
152 if (p < 0.0 | p > 1.0)
153 throw new IllegalArgumentException(
"p not in [0,1]");
154 if (u < 0.0 || u > 1.0)
155 throw new IllegalArgumentException(
"u not in [0,1]");
171 public static double[]
getMLE(
int[] x,
int m) {
173 throw new UnsupportedOperationException(
" m < 2");
177 for (
int i = 0; i < m; i++)
181 double param[] =
new double[1];
195 double param[] =
new double[1];
207 if (p < 0.0 || p > 1.0)
208 throw new IllegalArgumentException(
"p not in [0, 1]");
220 if (p < 0.0 || p > 1.0)
221 throw new IllegalArgumentException(
"p not in [0, 1]");
222 return (p * (1.0 - p));
247 double[] retour = { p };
263 return getClass().getSimpleName() +
" : p = " + p;
static double cdf(double p, int x)
Returns the Bernoulli distribution function with parameter (see eq.
static double prob(double p, int x)
Returns the Bernoulli probability with parameter (see eq.
static double[] getMLE(int[] x, int m)
Estimates the parameters of the Bernoulli distribution using the maximum likelihood method,...
int inverseFInt(double u)
Returns the inverse distribution function , where.
static double barF(double p, int x)
Returns the complementary Bernoulli distribution function.
void setParams(double p)
Resets the parameter to this new value.
String toString()
Returns a String containing information about the current distribution.
double getMean()
Returns the mean of the distribution function.
static double getMean(double p)
Returns the mean of the Bernoulli distribution with parameter .
static BernoulliDist getInstanceFromMLE(int[] x, int m)
Creates a new instance of a Bernoulli distribution with parameter.
static double getVariance(double p)
Computes the variance of the Bernoulli distribution with parameter .
static double getStandardDeviation(double p)
Computes the standard deviation of the Bernoulli distribution with parameter .
static int inverseF(double p, double u)
Returns the inverse of the Bernoulli distribution function with parameter at .
double getStandardDeviation()
Returns the standard deviation of the distribution function.
double getP()
Returns the parameter of this object.
double[] getParams()
Returns an array that contains the parameter of the current distribution: [ ].
BernoulliDist(double p)
Creates a Bernoulli distribution object.
double cdf(int x)
Returns the distribution function evaluated at (see ( FDistDisc )).
double prob(int x)
Returns , the probability of .
double getVariance()
Returns the variance of the distribution function.
double barF(int x)
Returns , the complementary distribution function.
Classes implementing discrete distributions over the integers should inherit from this class.