commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark R. Diggory" <>
Subject Re: [math] Questions regarding probability distributions
Date Wed, 13 Oct 2004 16:13:42 GMT wrote:
>>>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);
> }

Very Bad Idea, this means that GammaDistribution would have to implement 
Exponential and ChiSquare interfaces, if the "beta scale parameter" 
exposed in the Gamma interface were changed then this would be 
exceptionally confusing to the user. They could in a sense make a 
ChiSquare instance into some other distribution by changing the 
properties available on the class. This is what the default 
implementation of ChiSquareDist should be enforcing, if it is not, then 
the interface should be further restricted.

> Then you can drop ExponentialDistributionImpl and ChiSquaredDistributionImpl 
> altogether.

The way to do this is to maintain ExponentialDistributionImpl and 
ChiSquaredDistributionImpl as "wrappers" that just lockdown 
GammaDistribution to a specific configuration (via special Constructor 
and overriding the api to not allow the "beta scale parameter" to change).

This is the point of these interfaces/implementations. Yes, everyone 
could learn that these are all just variations on a Gamma distribution, 
I learned that in my college statistics class. But providing common 
default implementations is important for ease of use.


Mark Diggory
Software Developer
Harvard MIT Data Center

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message