org.apache.commons.math.distribution
Class DistributionFactoryImpl

java.lang.Object
  extended byorg.apache.commons.math.distribution.DistributionFactory
      extended byorg.apache.commons.math.distribution.DistributionFactoryImpl

public class DistributionFactoryImpl
extends DistributionFactory

A concrete distribution factory. This is the default factory used by Commons-Math.

Version:
$Revision: 201915 $ $Date: 2005-06-26 15:20:57 -0700 (Sun, 26 Jun 2005) $

Constructor Summary
DistributionFactoryImpl()
          Default constructor.
 
Method Summary
 BinomialDistribution createBinomialDistribution(int numberOfTrials, double probabilityOfSuccess)
          Create a binomial distribution with the given number of trials and probability of success.
 ChiSquaredDistribution createChiSquareDistribution(double degreesOfFreedom)
          Create a new chi-square distribution with the given degrees of freedom.
 ExponentialDistribution createExponentialDistribution(double mean)
          Create a new exponential distribution with the given degrees of freedom.
 FDistribution createFDistribution(double numeratorDegreesOfFreedom, double denominatorDegreesOfFreedom)
          Create a new F-distribution with the given degrees of freedom.
 GammaDistribution createGammaDistribution(double alpha, double beta)
          Create a new gamma distribution the given shape and scale parameters.
 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.
 NormalDistribution createNormalDistribution()
          Create a new normal distribution with the mean zero and standard deviation one.
 NormalDistribution createNormalDistribution(double mean, double sd)
          Create a new normal distribution with the given mean and standard deviation.
 PoissonDistribution createPoissonDistribution(double lambda)
          Create a new Poisson distribution with poisson parameter lambda.
 TDistribution createTDistribution(double degreesOfFreedom)
          Create a new t distribution with the given degrees of freedom.
 
Methods inherited from class org.apache.commons.math.distribution.DistributionFactory
createCauchyDistribution, createWeibullDistribution, newInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DistributionFactoryImpl

public DistributionFactoryImpl()
Default constructor. Package scope to prevent unwanted instantiation.

Method Detail

createChiSquareDistribution

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

Specified by:
createChiSquareDistribution in class DistributionFactory
Parameters:
degreesOfFreedom - degrees of freedom
Returns:
a new chi-square distribution

createGammaDistribution

public GammaDistribution createGammaDistribution(double alpha,
                                                 double beta)
Create a new gamma distribution the given shape and scale parameters.

Specified by:
createGammaDistribution in class DistributionFactory
Parameters:
alpha - the shape parameter
beta - the scale parameter
Returns:
a new gamma distribution

createTDistribution

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

Specified by:
createTDistribution in class DistributionFactory
Parameters:
degreesOfFreedom - degrees of freedom
Returns:
a new t distribution.

createFDistribution

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

Specified by:
createFDistribution in class DistributionFactory
Parameters:
numeratorDegreesOfFreedom - numerator degrees of freedom
denominatorDegreesOfFreedom - denominator degrees of freedom
Returns:
a new F-distribution

createExponentialDistribution

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

Specified by:
createExponentialDistribution in class DistributionFactory
Parameters:
mean - mean
Returns:
a new exponential distribution

createBinomialDistribution

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

Specified by:
createBinomialDistribution in class DistributionFactory
Parameters:
numberOfTrials - the number of trials
probabilityOfSuccess - the probability of success
Returns:
a new binomial distribution

createHypergeometricDistribution

public 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.

Specified by:
createHypergeometricDistribution in class DistributionFactory
Parameters:
populationSize - the population size
numberOfSuccesses - number of successes in the population
sampleSize - the sample size
Returns:
a new hypergeometric desitribution

createNormalDistribution

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

Specified by:
createNormalDistribution in class DistributionFactory
Parameters:
mean - the mean of the distribution
sd - standard deviation
Returns:
a new normal distribution

createNormalDistribution

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

Specified by:
createNormalDistribution in class DistributionFactory
Returns:
a new normal distribution

createPoissonDistribution

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

lambda must be postive; otherwise an IllegalArgumentException is thrown.

Specified by:
createPoissonDistribution in class DistributionFactory
Parameters:
lambda - poisson parameter
Returns:
a new Poisson distribution
Throws:
IllegalArgumentException - if lambda ≤ 0


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