net.sf.doodleproject.numerics4j.statistics.distribution
Class DiscreteDistribution

java.lang.Object
  extended by net.sf.doodleproject.numerics4j.statistics.distribution.DiscreteDistribution
All Implemented Interfaces:
Distribution
Direct Known Subclasses:
BinomialDistribution, GeometricDistribution, HypergeometricDistribution, NegativeBinomialDistribution, PoissonDistribution

public abstract class DiscreteDistribution
extends java.lang.Object
implements Distribution

Base discrete distribution.

Since:
1.2
Version:
$Revision: 1.2 $ $Date: 2007/10/25 04:44:10 $

Constructor Summary
DiscreteDistribution()
           
 
Method Summary
abstract  double cumulativeProbability(int x)
          The CDF for this distribution.
protected  int findInverseCumulativeProbability(double p, int lower, int initial, int upper)
          Generic means to compute inverse cumulative probability values.
abstract  int inverseCumulativeProbability(double p)
          The inverse CDF for this distribution.
abstract  double probability(int x)
          The PMF for this distribution.
protected  double simpleCumulativeProbability(int x0, int x1)
          Generic means to compute cumulative probability values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiscreteDistribution

public DiscreteDistribution()
Method Detail

cumulativeProbability

public abstract double cumulativeProbability(int x)
                                      throws NumericException
The CDF for this distribution. This method returns P(X ≤ x).

Parameters:
x - the value at which the CDF is evaluated.
Returns:
CDF for this distribution.
Throws:
NumericException - if the cumulative probability can not be computed.

simpleCumulativeProbability

protected double simpleCumulativeProbability(int x0,
                                             int x1)
                                      throws NumericException
Generic means to compute cumulative probability values. This method uses simple summation of the probability values to find CDF values.

Parameters:
x0 - the lower bound of summation.
x1 - the upper bound of summation.
Returns:
P(x0 ≤ X ≤ x1)
Throws:
NumericException - if the cumulative probability can not be computed.

findInverseCumulativeProbability

protected int findInverseCumulativeProbability(double p,
                                               int lower,
                                               int initial,
                                               int upper)
                                        throws NumericException
Generic means to compute inverse cumulative probability values. This method uses the bisection method to find inverse CDF values.

Parameters:
p - the cumulative probability.
lower - the global lower bound of the inverse CDF value.
initial - an initial guess at the inverse CDF value.
upper - the global upper bound of the inverse CDF value.
Returns:
x such that P(X ≤ x) = p
Throws:
NumericException - if the inverse cumulative probability can not be computed.

inverseCumulativeProbability

public abstract int inverseCumulativeProbability(double p)
                                          throws NumericException
The inverse CDF for this distribution. This method returns the largest x such that, P(X ≤ x) ≤ p.

Parameters:
p - the cumulative probability.
Returns:
x
Throws:
NumericException - if the inverse cumulative probability can not be computed.

probability

public abstract double probability(int x)
                            throws NumericException
The PMF for this distribution. This method returns P(X = x).

Parameters:
x - the value at which the probability is evaluated.
Returns:
PMF for this distribution.
Throws:
NumericException - if the probability can not be computed.


Copyright 2004-2004-2007 DoodleProject. All Rights Reserved.