Hi
I've been looking around for open source mathematical statistics software in
Java in the last couple of weeks and have tested the commonsmath 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 chisquared 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
