drasys.or.prob
Class BinomialDistributionBase

java.lang.Object
  |
  +--drasys.or.prob.Distribution
        |
        +--drasys.or.prob.DiscreteDistribution
              |
              +--drasys.or.prob.BinomialDistributionBase
Direct Known Subclasses:
BinomialDistribution

public class BinomialDistributionBase
extends DiscreteDistribution
implements DiscreteDistributionI

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
BinomialDistributionBase(double p, int n)
           
BinomialDistributionBase(double p, int n, FunctionsI functions)
          The functions object will be used for the 'lnGamma' and 'lnFactorial' methods.
BinomialDistributionBase(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.
 boolean equals(java.lang.Object o)
           
 int getRandomInteger()
          Returns a random number from the binomial distribution.
 double mean()
          Returns the mean of the distribution.
 double pdf(int x)
          Returns the value of the probability distribution function at x;
 double probability(int x1, int x2)
          Returns the probability that x >= x1 and x <= x2.
 void setParameters(double p, int n)
          Sets the distribution parameters.
 double std()
          Returns the standard deviation of the distribution.
 java.lang.String toString()
           
 double variance()
          Returns the variance of the distribution.
 
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

BinomialDistributionBase

public BinomialDistributionBase(double p,
                                int n)

BinomialDistributionBase

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

BinomialDistributionBase

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

setParameters

public void setParameters(double p,
                          int n)
Sets the distribution parameters.
Throws:
InvalidArgumentError - if mean <= 0.0.

getRandomInteger

public int getRandomInteger()
Returns a random number from the binomial distribution.
Specified by:
getRandomInteger in interface DiscreteDistributionI

mean

public double mean()
Returns the mean of the distribution.

variance

public double variance()
Returns the variance of the distribution.

std

public double std()
Returns the standard deviation of the distribution.

pdf

public double pdf(int x)
Returns the value of the probability distribution function at x;
Specified by:
pdf in interface DiscreteDistributionI
Throws:
InvalidArgumentError - if x < 0;

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
Throws:
InvalidArgumentError - if x < 0;

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
Throws:
InvalidArgumentError - if x2 < x1 or x1 < 0;

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


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