commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <p...@steitz.com>
Subject Re: [math] Questions regarding probability distributions
Date Wed, 13 Oct 2004 12:01:11 GMT
frno@bredband.net wrote:
> 
> 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.

Good point. I am +0 for dropping ChiSquaredDistributionImpl, but -1 for 
exponential (because of efficiency).  Unless others object, I will make 
that change.  Thanks for pointing this out.

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


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