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: 201915 $ $Date: 2005-06-26 15:20:57 -0700 (Sun, 26 Jun 2005) $

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.
 CauchyDistribution createCauchyDistribution(double median, double scale)
          Create a new cauchy distribution with the given median and scale.
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 shape and scale parameters.
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  NormalDistribution createNormalDistribution()
          Create a new normal distribution with mean zero and standard deviation one.
abstract  NormalDistribution createNormalDistribution(double mean, double sd)
          Create a new normal distribution with the given mean and standard deviation.
abstract  PoissonDistribution createPoissonDistribution(double lambda)
          Create a new Poisson distribution with poisson parameter lambda.
abstract  TDistribution createTDistribution(double degreesOfFreedom)
          Create a new t distribution with the given degrees of freedom.
 WeibullDistribution createWeibullDistribution(double alpha, double beta)
          Create a new Weibull distribution with the given shape and scale parameters.
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

createCauchyDistribution

public CauchyDistribution createCauchyDistribution(double median,
                                                   double scale)
Create a new cauchy distribution with the given median and scale.

Parameters:
median - the median of the distribution
scale - the scale
Returns:
a new cauchy distribution
Since:
1.1

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 shape and scale parameters.

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

createNormalDistribution

public abstract NormalDistribution createNormalDistribution(double mean,
                                                            double sd)
Create a new normal distribution with the given mean and standard deviation.

Parameters:
mean - the mean of the distribution
sd - standard deviation
Returns:
a new normal distribution

createNormalDistribution

public abstract NormalDistribution createNormalDistribution()
Create a new normal distribution with mean zero and standard deviation one.

Returns:
a new normal distribution.

createPoissonDistribution

public abstract PoissonDistribution createPoissonDistribution(double lambda)
Create a new Poisson distribution with poisson parameter lambda.

Parameters:
lambda - poisson parameter
Returns:
a new poisson distribution.

createWeibullDistribution

public WeibullDistribution createWeibullDistribution(double alpha,
                                                     double beta)
Create a new Weibull distribution with the given shape and scale parameters.

Parameters:
alpha - the shape parameter.
beta - the scale parameter.
Returns:
a new Weibull distribution.
Since:
1.1


Copyright © 2003-2008 The Apache Software Foundation. All Rights Reserved.