[ 
https://issues.apache.org/jira/browse/STATISTICS-62?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17683989#comment-17683989
 ] 

Gilles Sadowski commented on STATISTICS-62:
-------------------------------------------

{quote}
{code}
test(x, y, Object... options)
{code}
{quote}

I'm wary of dropping strongly typed arguments.

I rather like the clarity of the {{Options}} inner classes.  The "builder" 
pattern is verbose but Java is verbose (and isn't used anyways by developers 
who'd be put off by the syntax which you've shown).
It would already be nice that all the {{test(...)}} calls shared a similar 
syntax even if the {{Options}} classes are unrelated to each other.
Alternatively, could there be a single {{TestOptions}} class used by all test 
implementations (options that do not make sense for a given test would be 
"no-op" and missing mandatory settings would raise an exception)?

Also: I missed the reason for the {{test(...)}} method to be {{static}}.  E.g. 
why is
{code}
ChiSquareTest.test(expected, observed, DegreesOfFreedomAdjustment.of(1));
{code}
better than
{code}
ChiSquareTest.of(DegreesOfFreedomAdjustment.of(1)).test(expected, observed);
{code}
?

> Port o.a.c.math.stat.inference to a commons-statistics-inference module
> -----------------------------------------------------------------------
>
>                 Key: STATISTICS-62
>                 URL: https://issues.apache.org/jira/browse/STATISTICS-62
>             Project: Commons Statistics
>          Issue Type: New Feature
>          Components: inference
>    Affects Versions: 1.0
>            Reporter: Alex Herbert
>            Priority: Major
>
> The o.a.c.math4.legacy.stat.inference package contains:
>  
> {noformat}
> AlternativeHypothesis.java
> BinomialTest.java
> ChiSquareTest.java
> GTest.java
> InferenceTestUtils.java
> KolmogorovSmirnovTest.java
> MannWhitneyUTest.java
> OneWayAnova.java
> TTest.java
> WilcoxonSignedRankTest.java{noformat}
> The are few dependencies on other math packages. The notable exceptions are:
>  
> 1. KolmogorovSmirnovTest which requires matrix support. This is for 
> multiplication of a square matrix to support a matrix power function. This 
> uses a double matrix and the same code is duplicated for a BigFraction 
> matrix. Such code can be ported internally to support only the required 
> functions. It can also drop the defensive copy strategy used by Commons Math 
> in matrices to allow multiply in-place where appropriate for performance 
> gains.
> 2. OneWayAnova which collates the sum, sum of squares and count using 
> SummaryStatistics. This can be done using an internal class. It is possible 
> to call the test method using already computed SummaryStatistics. The method 
> that does this using the SummaryStatistics as part of the API can be dropped, 
> or supported using an interface that returns: getSum, getSumOfSquares, getN.
> All the inference Test classes have instance methods but no state. The 
> InferenceTestUtils is a static class that holds references to a singleton for 
> each class and provides static methods to pass through the underlying 
> instances.
> I suggest changing the test classes to have only static methods and dropping 
> InferenceTestUtils.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to