commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1241632 - in /commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference: OneWayAnova.java OneWayAnovaImpl.java
Date Tue, 07 Feb 2012 21:22:34 GMT
Author: tn
Date: Tue Feb  7 21:22:33 2012
New Revision: 1241632

URL: http://svn.apache.org/viewvc?rev=1241632&view=rev
Log:
Added algorithm convergence throws clauses to OneWayAnova classes as replacement of the generic
MathException.
JIRA: MATH-488

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/OneWayAnova.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/OneWayAnovaImpl.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/OneWayAnova.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/OneWayAnova.java?rev=1241632&r1=1241631&r2=1241632&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/OneWayAnova.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/OneWayAnova.java
Tue Feb  7 21:22:33 2012
@@ -16,7 +16,9 @@
  */
 package org.apache.commons.math.stat.inference;
 
+import org.apache.commons.math.exception.ConvergenceException;
 import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.MaxCountExceededException;
 import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.exception.OutOfRangeException;
 
@@ -76,9 +78,12 @@ public interface OneWayAnova {
      * @throws DimensionMismatchException if the length of the <code>categoryData</code>
      * array is less than 2 or a contained <code>double[]</code> array does not
have
      * at least two values
+     * @throws ConvergenceException if the p-value can not be computed due to a convergence
error
+     * @throws MaxCountExceededException if the maximum number of iterations is exceeded
      */
     double anovaPValue(Collection<double[]> categoryData)
-        throws NullArgumentException, DimensionMismatchException;
+        throws NullArgumentException, DimensionMismatchException,
+        ConvergenceException, MaxCountExceededException;
 
     /**
      * Performs an ANOVA test, evaluating the null hypothesis that there
@@ -103,8 +108,11 @@ public interface OneWayAnova {
      * array is less than 2 or a contained <code>double[]</code> array does not
have
      * at least two values
      * @throws OutOfRangeException if <code>alpha</code> is not in the range
(0, 0.5]
+     * @throws ConvergenceException if the p-value can not be computed due to a convergence
error
+     * @throws MaxCountExceededException if the maximum number of iterations is exceeded
      */
     boolean anovaTest(Collection<double[]> categoryData, double alpha)
-        throws NullArgumentException, DimensionMismatchException, OutOfRangeException;
+        throws NullArgumentException, DimensionMismatchException, OutOfRangeException,
+        ConvergenceException, MaxCountExceededException;
 
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/OneWayAnovaImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/OneWayAnovaImpl.java?rev=1241632&r1=1241631&r2=1241632&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/OneWayAnovaImpl.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/inference/OneWayAnovaImpl.java
Tue Feb  7 21:22:33 2012
@@ -19,8 +19,9 @@ package org.apache.commons.math.stat.inf
 import java.util.Collection;
 
 import org.apache.commons.math.distribution.FDistribution;
+import org.apache.commons.math.exception.ConvergenceException;
 import org.apache.commons.math.exception.DimensionMismatchException;
-import org.apache.commons.math.exception.MathIllegalArgumentException;
+import org.apache.commons.math.exception.MaxCountExceededException;
 import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.exception.OutOfRangeException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
@@ -67,9 +68,11 @@ public class OneWayAnovaImpl implements 
      * here</a></p>
      */
     public double anovaFValue(Collection<double[]> categoryData)
-        throws MathIllegalArgumentException {
+        throws NullArgumentException, DimensionMismatchException {
+
         AnovaStats a = anovaStats(categoryData);
         return a.F;
+
     }
 
     /**
@@ -83,10 +86,13 @@ public class OneWayAnovaImpl implements 
      * is the commons-math implementation of the F distribution.</p>
      */
     public double anovaPValue(Collection<double[]> categoryData)
-        throws NullArgumentException, DimensionMismatchException {
+        throws NullArgumentException, DimensionMismatchException,
+        ConvergenceException, MaxCountExceededException {
+
         AnovaStats a = anovaStats(categoryData);
         FDistribution fdist = new FDistribution(a.dfbg, a.dfwg);
         return 1.0 - fdist.cumulativeProbability(a.F);
+
     }
 
     /**
@@ -101,12 +107,15 @@ public class OneWayAnovaImpl implements 
      * <p>True is returned iff the estimated p-value is less than alpha.</p>
      */
     public boolean anovaTest(Collection<double[]> categoryData, double alpha)
-        throws NullArgumentException, DimensionMismatchException, OutOfRangeException {
+        throws NullArgumentException, DimensionMismatchException, OutOfRangeException,
+        ConvergenceException, MaxCountExceededException {
+
         if ((alpha <= 0) || (alpha > 0.5)) {
             throw new OutOfRangeException(LocalizedFormats.OUT_OF_BOUND_SIGNIFICANCE_LEVEL,
                                           alpha, 0, 0.5);
         }
         return anovaPValue(categoryData) < alpha;
+
     }
 
 



Mime
View raw message