commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@bredband.net
Subject Re: [math] Questions regarding probability distributions
Date Wed, 13 Oct 2004 08:16:46 GMT

> > 4.  Since the chi-squared and exponential distributions are just special
> > cases of the gamma distribution, there is no need to have separate
> > implementation classes for these. In my opinion, one should avoid having
> > multiple implementations of the same distribution unless there is some
> > strong reason for it.
>
> Please keep in mind that not every user is a full-blown statistician
> knowing all these underlying interactions. For that reason, I would
> argue strongly against this.
>

It wouldn't make any difference to the end user as I guess he's supposed to 
use the DistributionFactory to create the distributions he need.

You could keep the ExponentialDistribution and ChiSquaredDistribution 
interfaces and just change the following in DistributionFactoryImpl:

public ChiSquaredDistribution createChiSquareDistribution(
        final double degreesOfFreedom) {
 
 return new GammaDistributionImpl(degreesOfFreedom/2, 2);
}

public ExponentialDistribution createExponentialDistribution(double mean) {
        
 return new GammaDistributionImpl(1, mean);
}

Then you can drop ExponentialDistributionImpl and ChiSquaredDistributionImpl 
altogether.

I guess this is no big deal now but in general one should avoid having 
multiple implementations for the same distribution since that increases the 
risk for errors. In this case you could possibly argue that there is a small 
performance gain in having separate implementations, at least for the 
ExponentialDistribution.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message