|
SSJ V. 2.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.probdist.DiscreteDistribution
public class DiscreteDistribution
Classes implementing discrete distributions over a
finite set of real numbers should inherit from this class.
For discrete distributions over integers,
see DiscreteDistributionInt
.
We assume that the random variable X of interest can take one of the
n values
x0 < ... < xn-1 (which are sorted by increasing order).
It takes the value xk with probability
pk = P[X = xk].
In addition to the methods specified in the interface
Distribution
,
a method that returns the probability pk is supplied.
Note that the default implementation of the complementary distribution function returns 1.0 - cdf(x - 1), which is not accurate when F(x) is near 1.
Constructor Summary | |
---|---|
DiscreteDistribution(double[] params)
Constructs a discrete distribution whose parameters are given in a single ordered array: params[0] contains n, the number of values to consider. |
|
DiscreteDistribution(double[] obs,
double[] prob,
int n)
Constructs a discrete distribution over the n values contained in array obs, with probabilities given in array prob. |
|
DiscreteDistribution(int n,
double[] obs,
double[] prob)
Deprecated. |
Method Summary | |
---|---|
double |
barF(double x)
Returns bar(F)(x) = 1 - F(x). |
double |
cdf(double x)
Returns the distribution function F(x). |
double |
getMean()
Computes the mean E[X] = ∑i=1npixi of the distribution. |
double[] |
getParams()
Returns a table containing the parameters of the current distribution. |
double |
getStandardDeviation()
Computes the standard deviation of the distribution. |
double |
getVariance()
Computes the variance Var[X] = ∑i=1npi(xi - E[X])2 of the distribution. |
double |
getXinf()
Returns the lower limit xa of the support of the distribution. |
double |
getXsup()
Returns the upper limit xb of the support of the distribution. |
double |
inverseF(double u)
Returns the inverse distribution function F-1(u), defined in. |
double |
prob(int k)
Returns pk, the probability of the k-th observation, for 0 <= k < n. |
String |
toString()
Returns a String containing information about the current distribution. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DiscreteDistribution(double[] obs, double[] prob, int n)
@Deprecated public DiscreteDistribution(int n, double[] obs, double[] prob)
public DiscreteDistribution(double[] params)
Method Detail |
---|
public double prob(int k)
k
- observation number,
0 <= k < n
public double cdf(double x)
Distribution
cdf
in interface Distribution
x
- value at which the distribution function must be evaluated
public double barF(double x)
Distribution
barF
in interface Distribution
x
- value at which the complementary distribution function must be evaluated
public double inverseF(double u)
Distribution
inverseF
in interface Distribution
u
- value in the interval (0, 1) for which the inverse
distribution function is evaluated
public double getMean()
getMean
in interface Distribution
public double getVariance()
getVariance
in interface Distribution
public double getStandardDeviation()
getStandardDeviation
in interface Distribution
public double[] getParams()
getParams
in interface Distribution
public double getXinf()
public double getXsup()
public String toString()
toString
in class Object
|
SSJ V. 2.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |