org.jscience.mathematics.statistics
Class Distribution

java.lang.Object
  extended by org.jscience.mathematics.statistics.Distribution
Direct Known Subclasses:
BetaDistribution, BinomialDistribution, BinomialRandomNDistribution, BirthdayDistribution, CircleDistribution, ContinuousUniformDistribution, ConvolutionDistribution, CouponDistribution, DiscreteArcsineDistribution, ExtremeValueDistribution, FiniteDistribution, FiniteOrderStatisticDistribution, FisherDistribution, GammaDistribution, HypergeometricDistribution, LocationScaleDistribution, LogisticDistribution, LogNormalDistribution, MatchDistribution, MixtureDistribution, NegativeBinomialDistribution, NormalDistribution, OrderStatisticDistribution, ParetoDistribution, PoissonDistribution, StudentDistribution, TriangleDistribution, WalkMaxDistribution, WalkPositionDistribution, WeibullDistribution

public abstract class Distribution
extends java.lang.Object

This class models an abstract implementation of a real probability distribution.


Field Summary
static int CONTINUOUS
          DOCUMENT ME!
static int DISCRETE
          DOCUMENT ME!
static int MIXED
          DOCUMENT ME!
 
Constructor Summary
Distribution()
           
 
Method Summary
 double getCDF(double x)
          This method returns a default approximate cumulative distribution function.
abstract  double getDensity(double x)
          This method defines the probability density function of the distribution.
 DistributionDomain getDomain()
          This method returns the domain of the distribution.
 double getFailureRate(double x)
          This method computes the failure rate function.
 double getMaxDensity()
          This method returns the largest (finite) value of the probability density function on the finite set of domain values.
 double getMean()
          This method returns a default approximate mean.
 double getMedian()
          This method computes a default approximate median.
 double getMGF(double t)
          This method computes a default approximation to the moment generating function.
 double getMoment(double a, int n)
          This method returns a default approximation of the moment of a specified order about a specified point.
 double getMoment(int n)
          This method returns a default approximation of the moment of a specified order about 0.
 double getPGF(double t)
          This method computes a default approximation to the probability generating function.
 double getQuantile(double p)
          This method computes an approximate quantile function.
 double getSD()
          This method returns the standard deviation, as the square root of the variance.
 int getType()
          This method returns the type of the distribution (discrete or continuous).
 double getVariance()
          This method returns a default approximate variance.
protected  void setDomain(DistributionDomain d)
          This method sets the domain of the distribution for purposes of data collection and for default computations.
protected  void setDomain(double a, double b, double w, int t)
          This method sets the domain of the distribution for purposes of data collection and for default computations.
 double simulate()
          This method computes a default simulation of a value from the distribution, as a random quantile.
 java.lang.String toString()
          This method returns a string that gives the name of the distribution and the values of the parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DISCRETE

public static final int DISCRETE
DOCUMENT ME!

See Also:
Constant Field Values

CONTINUOUS

public static final int CONTINUOUS
DOCUMENT ME!

See Also:
Constant Field Values

MIXED

public static final int MIXED
DOCUMENT ME!

See Also:
Constant Field Values
Constructor Detail

Distribution

public Distribution()
Method Detail

getDensity

public abstract double getDensity(double x)
This method defines the probability density function of the distribution. This method must be overridden for any specific distribuiton.

Parameters:
x - a number in the domain of the distribution
Returns:
DOCUMENT ME!

setDomain

protected void setDomain(DistributionDomain d)
This method sets the domain of the distribution for purposes of data collection and for default computations. For a discrete distribution, the domain specifies the values on which the distribution is defined (although truncated if the true set of values is infinite). For a continuous distribution, domain defines the interval on which the distribuiton is defined (truncated if the true interval is infinite).

Parameters:
d - the domain

setDomain

protected void setDomain(double a,
                         double b,
                         double w,
                         int t)
This method sets the domain of the distribution for purposes of data collection and for default computations.

Parameters:
a - lower value or bound of the domain
b - the upper value or bound of the domain
w - the width (step size) of the domain
t - the type of domain (DISCRETE or CONTINUOUS)

getDomain

public DistributionDomain getDomain()
This method returns the domain of the distribution.

Returns:
the domain

getType

public final int getType()
This method returns the type of the distribution (discrete or continuous).

Returns:
the type

getMaxDensity

public double getMaxDensity()
This method returns the largest (finite) value of the probability density function on the finite set of domain values. This method should be overridden if the maximum value is known in closed form.

Returns:
the maximum value of the probability density function

getMoment

public double getMoment(double a,
                        int n)
This method returns a default approximation of the moment of a specified order about a specified point. This method should be overriden if the moment is known in closed form.

Parameters:
a - the center
n - the order
Returns:
the moment of order n about a

getMoment

public double getMoment(int n)
This method returns a default approximation of the moment of a specified order about 0. This method should be overriden if the moment is known in closed form.

Parameters:
n - the order
Returns:
the moment of order n

getMean

public double getMean()
This method returns a default approximate mean. This method should be overriden if the mean is known in closed form.

Returns:
the mean

getVariance

public double getVariance()
This method returns a default approximate variance. This method should be overriden if the variance is known in closed form.

Returns:
the variance

getSD

public double getSD()
This method returns the standard deviation, as the square root of the variance.

Returns:
the standard deviation

getCDF

public double getCDF(double x)
This method returns a default approximate cumulative distribution function. This should be overriden if the CDF is known in closed form.

Parameters:
x - a number in the domain of the distribution
Returns:
the cumulative probability at x

getQuantile

public double getQuantile(double p)
This method computes an approximate quantile function. This should be overriden if the quantile function is known in closed form.

Parameters:
p - a probability in (0, 1)
Returns:
the quantile of order p

simulate

public double simulate()
This method computes a default simulation of a value from the distribution, as a random quantile. This method should be overridden if a better method of simulation is known.

Returns:
a simulated value from the distribution

getMedian

public double getMedian()
This method computes a default approximate median. This method should be overriden when there is a closed form expression for the median.

Returns:
the median

getFailureRate

public double getFailureRate(double x)
This method computes the failure rate function.

Parameters:
x - a number in the domain of the distribution
Returns:
the failure rate at x

getMGF

public double getMGF(double t)
This method computes a default approximation to the moment generating function. The moment generating function is the generating function often used for continuous distributions. This method should be overriden if the MGF is known in closed form.

Parameters:
t - a real number
Returns:
the moment generating function at t

getPGF

public double getPGF(double t)
This method computes a default approximation to the probability generating function. The probability generating function is the generating function often used for discrete, distributions on the non-negative integers. This method should be overriden if the PGF is known in closed form.

Parameters:
t - a real number
Returns:
the probability generating function at t

toString

public java.lang.String toString()
This method returns a string that gives the name of the distribution and the values of the parameters.

Overrides:
toString in class java.lang.Object
Returns:
a string giving the name of the distribution and the values of the parameters