org.apache.commons.math.distribution
Class DistributionFactory

java.lang.Object
  extended byorg.apache.commons.math.distribution.DistributionFactory
Direct Known Subclasses:
DistributionFactoryImpl

public abstract class DistributionFactory
extends Object

This factory provids the means to create common statistical distributions. The following distributions are supported:

Common usage:
 DistributionFactory factory = DistributionFactory.newInstance();
 
 // create a Chi-Square distribution with 5 degrees of freedom.
 ChiSquaredDistribution chi = factory.createChiSquareDistribution(5.0);
 

Version:
$Revision: 1.17 $ $Date: 2003/11/15 16:01:35 $

Constructor Summary
protected DistributionFactory()
          Default constructor.
 
Method Summary
abstract  BinomialDistribution createBinomialDistribution(int numberOfTrials, double probabilityOfSuccess)
          Create a binomial distribution with the given number of trials and probability of success.
abstract  ChiSquaredDistribution createChiSquareDistribution(double degreesOfFreedom)
          Create a new chi-square distribution with the given degrees of freedom.
abstract  ExponentialDistribution createExponentialDistribution(double mean)
          Create a new exponential distribution with the given degrees of freedom.
abstract  FDistribution createFDistribution(double numeratorDegreesOfFreedom, double denominatorDegreesOfFreedom)
          Create a new F-distribution with the given degrees of freedom.
abstract  GammaDistribution createGammaDistribution(double alpha, double beta)
          Create a new gamma distribution with the given alpha and beta values.
abstract  HypergeometricDistribution createHypergeometricDistribution(int populationSize, int numberOfSuccesses, int sampleSize)
          Create a new hypergeometric distribution with the given the population size, the number of successes in the population, and the sample size.
abstract  TDistribution createTDistribution(double degreesOfFreedom)
          Create a new t distribution with the given degrees of freedom.
static DistributionFactory newInstance()
          Create an instance of a DistributionFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DistributionFactory

protected DistributionFactory()
Default constructor.

Method Detail

newInstance

public static DistributionFactory newInstance()
Create an instance of a DistributionFactory

Returns:
a new factory.

createBinomialDistribution

public abstract BinomialDistribution createBinomialDistribution(int numberOfTrials,
                                                                double probabilityOfSuccess)
Create a binomial distribution with the given number of trials and probability of success.

Parameters:
numberOfTrials - the number of trials.
probabilityOfSuccess - the probability of success.
Returns:
a new binomial distribution.

createChiSquareDistribution

public abstract ChiSquaredDistribution createChiSquareDistribution(double degreesOfFreedom)
Create a new chi-square distribution with the given degrees of freedom.

Parameters:
degreesOfFreedom - degrees of freedom.
Returns:
a new chi-square distribution.

createExponentialDistribution

public abstract ExponentialDistribution createExponentialDistribution(double mean)
Create a new exponential distribution with the given degrees of freedom.

Parameters:
mean - mean.
Returns:
a new exponential distribution.

createFDistribution

public abstract FDistribution createFDistribution(double numeratorDegreesOfFreedom,
                                                  double denominatorDegreesOfFreedom)
Create a new F-distribution with the given degrees of freedom.

Parameters:
numeratorDegreesOfFreedom - numerator degrees of freedom.
denominatorDegreesOfFreedom - denominator degrees of freedom.
Returns:
a new F-distribution.

createGammaDistribution

public abstract GammaDistribution createGammaDistribution(double alpha,
                                                          double beta)
Create a new gamma distribution with the given alpha and beta values.

Parameters:
alpha - the shape parameter.
beta - the scale parameter.
Returns:
a new gamma distribution.

createTDistribution

public abstract TDistribution createTDistribution(double degreesOfFreedom)
Create a new t distribution with the given degrees of freedom.

Parameters:
degreesOfFreedom - degrees of freedom.
Returns:
a new t distribution.

createHypergeometricDistribution

public abstract HypergeometricDistribution createHypergeometricDistribution(int populationSize,
                                                                            int numberOfSuccesses,
                                                                            int sampleSize)
Create a new hypergeometric distribution with the given the population size, the number of successes in the population, and the sample size.

Parameters:
populationSize - the population size.
numberOfSuccesses - number of successes in the population.
sampleSize - the sample size.
Returns:
a new hypergeometric desitribution.


Copyright © 2003-2004 Apache Software Foundation. All Rights Reserved.