You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by fr...@bredband.net on 2004/10/12 20:58:34 UTC
[math] Questions regarding probability distributions
Hi
I've been looking around for open source mathematical statistics software in
Java in the last couple of weeks and have tested the commons-math package.
After looking into it I have a few questions and comments.
1. The MathUtils.factorial(final int n) method throws an
IllegalArgumentException for n=0 which is clearly incorrect since 0!=1 by
definition.
2. I think the distinction between discrete and continuous probability
distributions manifested in the interfaces DiscreteDistribution and
ContinuousDistribution is rather questionable There is no requirement that
a discrete distribution only takes on integer values so the methods of
interface DiscreteDistribution doesn't cover all discrete distributions. On
the other hand, all of the methods of ContinuousDistribution holds equally
well for a discrete probability distribution. In my opinion, a more
appropriate approach would be to rename ContinuousDistribution to
ProbabilityDistribution and drop the DiscreteDistribution interface. Of
course, it could be practical to have convenience methods that takes integer
arguments for the probability densities for certain distributions but then
you can define a new interface IntegerValuedDistribution like
public interface IntegerValuedDistribution extends ProbabilityDistribution {
double probability(int x);
double cumulativeProbability(int x) throws MathException;
}
3. Wouldn't it be nice to have convenience methods for calculating
the moments for each distribution? Something along the lines of
public double getMoment(int order) throws MomentDoesNotExistException;
for calculating the moments EX^order (if they exist)?
At least there could be methods for obtaining the mean and variance of a
distribution.
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.
5. There are quite a lot of elementary distributions missing.
I wrote an implementation of the Poisson distribution while testing the
package and have attached the files for it.
Best regards,
Frank N
Re: [math] Questions regarding probability distributions
Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
frno@bredband.net 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
--
Mark Diggory
Software Developer
Harvard MIT Data Center
http://www.hmdc.harvard.edu
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [math] Questions regarding probability distributions
Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
I definitely against removing these implementations. These
interfaces/implementations provide a a unique set of methods on that
specific species of Gamma distribution that are required to configure
and maintain that species of Gamma distribution.
Removing the underlying implementations and making a
GammaDistributionImpl implement the ChiSquareDistibution interface is
risky and difficult venture, there would be no way to enforce the
"immutability" of the scale parameter required to maintain its
"ChiSquareness".
-Mark
Kim van der Linde wrote:
>
>
> Phil Steitz wrote:
>
>> 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.
>
>
> I do not mind HOW it is in the package, but I would argue against an
> option where the user has to know which parameters need to be fed to an
> more general underlying distribution, especially when it is a common
> used one such as chi-square. Unless of course, you want to limit this
> package to a hard core public only.
>
> Cheers,
>
> Kim
--
Mark Diggory
Software Developer
Harvard MIT Data Center
http://www.hmdc.harvard.edu
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [math] Questions regarding probability distributions
Posted by Kim van der Linde <ki...@kimvdlinde.com>.
Phil Steitz wrote:
> 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.
I do not mind HOW it is in the package, but I would argue against an
option where the user has to know which parameters need to be fed to an
more general underlying distribution, especially when it is a common
used one such as chi-square. Unless of course, you want to limit this
package to a hard core public only.
Cheers,
Kim
--
http://www.kimvdlinde.com
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [math] Questions regarding probability distributions
Posted by Phil Steitz <ph...@steitz.com>.
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
Re: [math] Questions regarding probability distributions
Posted by fr...@bredband.net.
> > 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
Re: [math] Questions regarding probability distributions
Posted by Kim van der Linde <ki...@kimvdlinde.com>.
frno@bredband.net wrote:
> Hi
> 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.
Kim
--
http://www.kimvdlinde.com
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [math] Questions regarding probability distributions
Posted by F Norin <fr...@bredband.net>.
> > Well, the problem is this: If I need to create some custom discrete
> > distribution that doesn't take on integer values, what interface should I
> > implement? With your model I have no choice but use the
> > ContinuousDistribution interface even though the distribution *isn't*
> > continuous. Does that make sense?
>
> Can you provide a practical example of this? IIUC, what you are really
> arguing for is changing the int's in the DiscreteDistribution interface to
> doubles. This has the advantage of greater generality but makes it
> slightly less convenient for implementors of the most common discrete
> distributions, where the values are integers.
Well, changing the int's in the DiscreteDistribution interface to doubles is
kind of a workaround, but I don't think it will settle the issue for good,
see below.
As for examples, you can take *any* mixed distribution as an example of what I
mean. Consider a random variable X with domain D that can be partitioned
into subsets A and B such that
1. A is a countable set and 0 < P(X is in A) < 1
2. P(X = x) = 0 for all x in B
How would the distribution for such a random variable be represented in
your framework?
As a simple example of this, consider a random variable with the density
f(x) = 0.5 for x=0
f(x) = 0.5 for 1<x<2
How does this distribution fit into your framework? Sure, you could have
it implement the ContinuousDistribution interface but it *isn't* a
continuous distribution (in the sense that it doesn't conform to the
definition of a continuous distribution in probability theory) - and
then it shouldn't implement an interface called ContinuousDistribution.
Recall: A random variable is continuous if its distribution function P(X <= x)
can be expressed as the Riemann-integral of some integrable function
f: R -> [0, infinity)
The basic problem is that you have an implicit assumption in your
framework that each and every probability distribution can be classified
as being either discrete or continuous . That is simply not true.
Discrete and continuous distributions are really only special cases of
a broader concept. Aside from that you also have the problem of how to
handle the case of a discrete distribution that doesn't take on integer
values.
Note: There are also distributions that are neither discrete, continuous or a
mixture of the two. For example, there are numerous distributions based upon
the Cantor ternary sets.
The bottom line is that you *cannot* do without a generic
ProbabilityDistribution interface.
This interface should expose a method that exists for all and completely
determines a particular probability distribution, such as the
distribution function P(X <= x).
As an easy solution, you could define it as
public interface ProbabilityDistribution {
public double distributionFunction(double x);
}
and have ContinuousDistribution and DiscreteDistribution extend it.
This should work ok (though the name DiscreteDistribution is misleading)
but if you want a completely generic and typesafe definition you should
go for something like
public interface ProbabilityDistribution {
public Probability distributionFunction(Number x);
}
where Number is the standard java.lang.Number and Probability is a new
class that would need to be defined. Since probability measure is the
fundamental concept in probability theory, having a Probability class is
probably a good idea anyway. It could look something like this
public final class Probability implements Serializable {
public static final Probability PROPABILITY_ONE = new
Probability(1);
public static final Probability PROPABILITY_ZERO = new
Probability(0);
private double value;
public Probability(double v) throws IllegalArgumentException {
if (v < 0 || v > 1) {
throw new IllegalArgumentException("Illegal probability
value.");
}
this.value = v;
}
public double value() {
return value;
}
}
(A custom equals method should also be provided of course.)
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [math] Questions regarding probability distributions
Posted by Phil Steitz <ph...@steitz.com>.
frno@bredband.net wrote:
>>Some may disagree with that definition (really amounts to a convention on
>>how to handle vacuuous products); but I think that I agree with you.
>>Unless others object, I will consider this a bug and make the change.
>>Thanks for pointing this oddity out. Would you mind opening a bugzilla
>>ticket to track this?
>
>
> Fixed that.
Thanks!
>
>
> Well, the problem is this: If I need to create some custom discrete
> distribution that doesn't take on integer values, what interface should I
> implement? With your model I have no choice but use the
> ContinuousDistribution interface even though the distribution *isn't*
> continuous. Does that make sense?
Can you provide a practical example of this? IIUC, what you are really
arguing for is changing the int's in the DiscreteDistribution interface to
doubles. This has the advantage of greater generality but makes it
slightly less convenient for implementors of the most common discrete
distributions, where the values are integers.
>
> You're right that the domain of every discrete distribution could be mapped
> into the integers, but then there should be some mechanism for internalizing
> this mapping for a particular distribution. Every discrete distribution
> should have a reference to a Domain object that provides a method for mapping
> every object of the set into the integers. Using such a scheme you could keep
> separate interfaces for discrete and continuous distributions. (Actually, the
> continuous distributions could have a Domain object too).
Hmm, one problem that I am now seeing is in computing moments of "mapped"
discrete distributions. Something like what you are describing above will
be necessary. So...if there are practical examples out there, I am
beginning to think that we need to either a) change the ints to doubles in
DiscreteDistribution or b) support "value mapping" in some systematic way.
Phil
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [math] Questions regarding probability distributions
Posted by fr...@bredband.net.
> Some may disagree with that definition (really amounts to a convention on
> how to handle vacuuous products); but I think that I agree with you.
> Unless others object, I will consider this a bug and make the change.
> Thanks for pointing this oddity out. Would you mind opening a bugzilla
> ticket to track this?
Fixed that.
> > There is no requirement that
> > a discrete distribution only takes on integer values so the methods of
> > interface DiscreteDistribution doesn't cover all discrete distributions.
>
> Technically, you are correct - a discrete random variable can take on any
> (countable) set of values. The key difference, however, is that for a
> discrete random variable X, if x is one of the values that it takes with
> positive probability, p(X=x) is non-zero. Therefore, it makes sense to
> have probability(x) defined (as it is) in the DiscreteDistribution
> interface, but absent from the ContinuousDistribution interface. More
> care also needs to be taken in the discrete case to define and implement
> p(a < X < b) type quantities including or excluding endpoints
> appropriately (since it makes a difference whether or not endpoints are
> included).
>
> In fairness, the DiscreteDistribution interface only supports
> integer-valued distributions. The only ones that I have ever used are
> integer-valued, and any odd countable set can be mapped into the integers,
> so I don't personally view this as a serious limitation.
>
> On
>
> > the other hand, all of the methods of ContinuousDistribution holds
> > equally well for a discrete probability distribution.
>
> With slightly different semantics, as noted above.
>
> In my opinion, a more
>
> > appropriate approach would be to rename ContinuousDistribution to
> > ProbabilityDistribution and drop the DiscreteDistribution interface. Of
> > course, it could be practical to have convenience methods that takes
> > integer arguments for the probability densities for certain distributions
> > but then you can define a new interface IntegerValuedDistribution like
> >
> > public interface IntegerValuedDistribution extends
> > ProbabilityDistribution { double probability(int x);
> > double cumulativeProbability(int x) throws MathException;
> > }
>
> I see your point here and it is legitimate. I am -0 to making the change,
> however, since the interface contract (for the base interface) would in
> practical terms be different for the discrete case, so I think it is
> better to keep them separate.
Well, the problem is this: If I need to create some custom discrete
distribution that doesn't take on integer values, what interface should I
implement? With your model I have no choice but use the
ContinuousDistribution interface even though the distribution *isn't*
continuous. Does that make sense?
You're right that the domain of every discrete distribution could be mapped
into the integers, but then there should be some mechanism for internalizing
this mapping for a particular distribution. Every discrete distribution
should have a reference to a Domain object that provides a method for mapping
every object of the set into the integers. Using such a scheme you could keep
separate interfaces for discrete and continuous distributions. (Actually, the
continuous distributions could have a Domain object too).
> > 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.
>
> Well, the chi-square implementation wraps a gamma instance. The
> exponential implementation computes the exponential density explicitly.
> In any case, the distributions are different (though related) and
> sufficiently useful in their own rights that exposing them separately will
> be easier for users.
See my answer to another post.
> > 5. There are quite a lot of elementary distributions missing.
> > I wrote an implementation of the Poisson distribution while testing the
> > package and have attached the files for it.
>
> Yes!! That is why the framework was designed to support adding
> distributions. Could you open a bugzilla ticket and attach the files
> there? I will review and get these in ASAP.
Fixed that.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [math] Questions regarding probability distributions
Posted by Al Chou <ho...@yahoo.com>.
--- Phil Steitz <ph...@steitz.com> wrote:
> Thanks for the feedback and the contribution!
>
> See comments interspersed below.
>
> frno@bredband.net wrote:
> > Hi
> >
> > I've been looking around for open source mathematical statistics software
> in
> > Java in the last couple of weeks and have tested the commons-math package.
> > After looking into it I have a few questions and comments.
> >
> > 1. The MathUtils.factorial(final int n) method throws an
> > IllegalArgumentException for n=0 which is clearly incorrect since 0!=1 by
> > definition.
>
> Some may disagree with that definition (really amounts to a convention on
> how to handle vacuuous products); but I think that I agree with you.
> Unless others object, I will consider this a bug and make the change.
> Thanks for pointing this oddity out. Would you mind opening a bugzilla
> ticket to track this?
>
<http://issues.apache.org/bugzilla/enter_bug.cgi?product=Commons&component=Math>
factorial( 0 ) === 1 by definition, as stated above. Any definition of
factorial that differs from that is not mathematically correct and will
surprise those who expect the mathematical definition. So, +1 to making the
change.
> > 3. Wouldn't it be nice to have convenience methods for calculating
> > the moments for each distribution? Something along the lines of
> > public double getMoment(int order) throws MomentDoesNotExistException;
> >
> > for calculating the moments EX^order (if they exist)?
> > At least there could be methods for obtaining the mean and variance of a
> > distribution.
>
> Yes!! We thought about adding these to the interfaces but were concerned
> that in some cases they would be hard to implement (or impossible -- if
> they don't exist ;-) There is nothing preventing us from adding them to
> the implementations, however, or adding another interface or utilities to
> compute them. Does anyone see a reason that we need to add them now,
> before releasing 1.0?
Not being a statistician, I think I can only vote -0 (not -1) to adding them at
this time, in good conscience.
> > 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.
>
> Well, the chi-square implementation wraps a gamma instance. The
> exponential implementation computes the exponential density explicitly.
> In any case, the distributions are different (though related) and
> sufficiently useful in their own rights that exposing them separately will
> be easier for users.
I agree they should remain separate. Although we have yet to really see who
our users are, it seems reasonable, given Commons Math's charter, to keep ease
of comprehension/use as one of our goals. Mathematical sophistication should
not be a prerequisite (or lack thereof present a barrier) to entry into using
this library.
Al
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [math] Questions regarding probability distributions
Posted by Phil Steitz <ph...@steitz.com>.
Thanks for the feedback and the contribution!
See comments interspersed below.
frno@bredband.net wrote:
> Hi
>
> I've been looking around for open source mathematical statistics software in
> Java in the last couple of weeks and have tested the commons-math package.
> After looking into it I have a few questions and comments.
>
> 1. The MathUtils.factorial(final int n) method throws an
> IllegalArgumentException for n=0 which is clearly incorrect since 0!=1 by
> definition.
Some may disagree with that definition (really amounts to a convention on
how to handle vacuuous products); but I think that I agree with you.
Unless others object, I will consider this a bug and make the change.
Thanks for pointing this oddity out. Would you mind opening a bugzilla
ticket to track this?
<http://issues.apache.org/bugzilla/enter_bug.cgi?product=Commons&component=Math>
>
> 2. I think the distinction between discrete and continuous probability
> distributions manifested in the interfaces DiscreteDistribution and
> ContinuousDistribution is rather questionable.
Here I don't think I agree. Continuous and discrete distributions are
fundamentally different. See below.
> There is no requirement that
> a discrete distribution only takes on integer values so the methods of
> interface DiscreteDistribution doesn't cover all discrete distributions.
Technically, you are correct - a discrete random variable can take on any
(countable) set of values. The key difference, however, is that for a
discrete random variable X, if x is one of the values that it takes with
positive probability, p(X=x) is non-zero. Therefore, it makes sense to
have probability(x) defined (as it is) in the DiscreteDistribution
interface, but absent from the ContinuousDistribution interface. More
care also needs to be taken in the discrete case to define and implement
p(a < X < b) type quantities including or excluding endpoints
appropriately (since it makes a difference whether or not endpoints are
included).
In fairness, the DiscreteDistribution interface only supports
integer-valued distributions. The only ones that I have ever used are
integer-valued, and any odd countable set can be mapped into the integers,
so I don't personally view this as a serious limitation.
On
> the other hand, all of the methods of ContinuousDistribution holds equally
> well for a discrete probability distribution.
With slightly different semantics, as noted above.
In my opinion, a more
> appropriate approach would be to rename ContinuousDistribution to
> ProbabilityDistribution and drop the DiscreteDistribution interface. Of
> course, it could be practical to have convenience methods that takes integer
> arguments for the probability densities for certain distributions but then
> you can define a new interface IntegerValuedDistribution like
>
> public interface IntegerValuedDistribution extends ProbabilityDistribution {
> double probability(int x);
> double cumulativeProbability(int x) throws MathException;
> }
I see your point here and it is legitimate. I am -0 to making the change,
however, since the interface contract (for the base interface) would in
practical terms be different for the discrete case, so I think it is
better to keep them separate.
>
> 3. Wouldn't it be nice to have convenience methods for calculating
> the moments for each distribution? Something along the lines of
> public double getMoment(int order) throws MomentDoesNotExistException;
>
> for calculating the moments EX^order (if they exist)?
> At least there could be methods for obtaining the mean and variance of a
> distribution.
Yes!! We thought about adding these to the interfaces but were concerned
that in some cases they would be hard to implement (or impossible -- if
they don't exist ;-) There is nothing preventing us from adding them to
the implementations, however, or adding another interface or utilities to
compute them. Does anyone see a reason that we need to add them now,
before releasing 1.0?
> 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.
Well, the chi-square implementation wraps a gamma instance. The
exponential implementation computes the exponential density explicitly.
In any case, the distributions are different (though related) and
sufficiently useful in their own rights that exposing them separately will
be easier for users.
>
> 5. There are quite a lot of elementary distributions missing.
> I wrote an implementation of the Poisson distribution while testing the
> package and have attached the files for it.
Yes!! That is why the framework was designed to support adding
distributions. Could you open a bugzilla ticket and attach the files
there? I will review and get these in ASAP.
Thanks again for the feedback and contribution.
Phil
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org