drasys.or.prob
Class BinomialDistribution

java.lang.Object
  |
  +--drasys.or.prob.Distribution
        |
        +--drasys.or.prob.DiscreteDistribution
              |
              +--drasys.or.prob.BinomialDistributionBase
                    |
                    +--drasys.or.prob.BinomialDistribution

public class BinomialDistribution
extends BinomialDistributionBase
implements DiscreteDistributionI, FunctionI

An implementation of the Binomial probability distribution.

References:

The Art of Computer Programming: Seminumerical Algorithms (Vol 2, 3rd Ed)
    Donald Ervin Knuth; Hardcover
Numerical Recipes in C : The Art of Scientific Computing
    William H. Press, et al / Hardcover / Published 1993
Probability and Statistics
    Morris H. Degroot / Hardcover / Published 1986
Mathematical Statistics With Applications
    Dennis D. Wackerly, et al / Hardcover / Published 1996

See Also:
Serialized Form

Constructor Summary
BinomialDistribution(double p, int n)
           
BinomialDistribution(double p, int n, FunctionsI functions)
          The functions object will be used for the 'lnGamma' and 'lnFactorial' methods.
BinomialDistribution(double p, int n, long seed)
           
 
Method Summary
 double cdf(int x)
          Returns the value of the cumulative distribution function at x; The standard edition iterates the pdf (x+1) times.
static double computeProportion(int n, int x, double cdf)
          Compute the parameter 'p' which fits a binomial distribution to the arguments.
 double function(double x)
          Continuous implementation of the CDF, used to compute the inverse CDF.
 int inverseCdf(double probability)
          Computes the integer with the nearest cdf to probability.
 double probability(int x1, int x2)
          Returns the probability that x >= x1 and x <= x2.
 
Methods inherited from class drasys.or.prob.BinomialDistributionBase
equals, getRandomInteger, mean, pdf, setParameters, std, toString, variance
 
Methods inherited from class drasys.or.prob.DiscreteDistribution
cdf, getRandomArray, getRandomArray, getRandomScaler, pdf, probability, probability
 
Methods inherited from class drasys.or.prob.Distribution
getRandomMatrix, getRandomNumberGenerator, getRandomVector, setElements, setElements, setRandomNumberGenerator, setSeed
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BinomialDistribution

public BinomialDistribution(double p,
                            int n)

BinomialDistribution

public BinomialDistribution(double p,
                            int n,
                            long seed)

BinomialDistribution

public BinomialDistribution(double p,
                            int n,
                            FunctionsI functions)
The functions object will be used for the 'lnGamma' and 'lnFactorial' methods.
Method Detail

computeProportion

public static double computeProportion(int n,
                                       int x,
                                       double cdf)
Compute the parameter 'p' which fits a binomial distribution to the arguments.

cdf

public double cdf(int x)
Returns the value of the cumulative distribution function at x; The standard edition iterates the pdf (x+1) times. The professional edition uses the incomplete beta function.
Specified by:
cdf in interface DiscreteDistributionI
Overrides:
cdf in class BinomialDistributionBase
Throws:
InvalidArgumentError - if x < 0;

function

public double function(double x)
Continuous implementation of the CDF, used to compute the inverse CDF.
Specified by:
function in interface FunctionI

inverseCdf

public int inverseCdf(double probability)
Computes the integer with the nearest cdf to probability.
Throws:
StatError - if the solution fails.

probability

public double probability(int x1,
                          int x2)
Returns the probability that x >= x1 and x <= x2. The standard edition iterates the pdf (x2-x1+1) times. The professional edition uses the incomplete beta function.
Specified by:
probability in interface DiscreteDistributionI
Overrides:
probability in class BinomialDistributionBase
Throws:
InvalidArgumentError - if x2 < x1 or x1 < 0;


Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com