JSci.maths.statistics
Class ProbabilityDistribution

java.lang.Object
  extended byJSci.maths.statistics.ProbabilityDistribution
Direct Known Subclasses:
BetaDistribution, BinomialDistribution, CauchyDistribution, ChiSqrDistribution, ExponentialDistribution, FDistribution, GammaDistribution, GeometricDistribution, LognormalDistribution, NormalDistribution, ParetoDistribution, PoissonDistribution, TDistribution, WeibullDistribution

public abstract class ProbabilityDistribution
extends java.lang.Object

The ProbabilityDistribution superclass provides an object for encapsulating probability distributions.


Constructor Summary
ProbabilityDistribution()
          Constructs a probability distribution.
 
Method Summary
protected  void checkRange(double x)
          Check if the range of the argument of the distribution method is between 0.0 and 1.0.
protected  void checkRange(double x, double lo, double hi)
          Check if the range of the argument of the distribution method is between lo and hi.
abstract  double cumulative(double X)
          Cumulative distribution function.
protected  double findRoot(double prob, double guess, double xLo, double xHi)
          This method approximates the value of X for which P(x<X)=prob.
abstract  double inverse(double probability)
          Inverse of the cumulative distribution function.
abstract  double probability(double X)
          Probability density function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProbabilityDistribution

public ProbabilityDistribution()
Constructs a probability distribution.

Method Detail

probability

public abstract double probability(double X)
Probability density function.

Returns:
the probability that a stochastic variable x has the value X, i.e. P(x=X).

cumulative

public abstract double cumulative(double X)
Cumulative distribution function.

Returns:
the probability that a stochastic variable x is less then X, i.e. P(x<X).

inverse

public abstract double inverse(double probability)
Inverse of the cumulative distribution function.

Returns:
the value X for which P(x<X).

checkRange

protected final void checkRange(double x,
                                double lo,
                                double hi)
Check if the range of the argument of the distribution method is between lo and hi.

Throws:
OutOfRangeException - If the argument is out of range.

checkRange

protected final void checkRange(double x)
Check if the range of the argument of the distribution method is between 0.0 and 1.0.

Throws:
OutOfRangeException - If the argument is out of range.

findRoot

protected final double findRoot(double prob,
                                double guess,
                                double xLo,
                                double xHi)
This method approximates the value of X for which P(x<X)=prob. It applies a combination of a Newton-Raphson procedure and bisection method with the value guess as a starting point. Furthermore, to ensure convergency and stability, one should supply an inverval [xLo,xHi] in which the probalility distribution reaches the value prob. The method does no checking, it will produce bad results if wrong values for the parameters are supplied - use it with care.