commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Al Chou <hotfusion...@yahoo.com>
Subject Re: [math] Questions regarding probability distributions
Date Wed, 13 Oct 2004 04:18:58 GMT
--- Phil Steitz <phil@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


Mime
View raw message