You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ps...@apache.org on 2009/02/08 20:30:09 UTC

svn commit: r742145 - /commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/SimpleRegression.java

Author: psteitz
Date: Sun Feb  8 19:30:09 2009
New Revision: 742145

URL: http://svn.apache.org/viewvc?rev=742145&view=rev
Log:
Exposed sums of squares.

Modified:
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/SimpleRegression.java

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/SimpleRegression.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/SimpleRegression.java?rev=742145&r1=742144&r2=742145&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/SimpleRegression.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/SimpleRegression.java Sun Feb  8 19:30:09 2009
@@ -352,6 +352,29 @@
         }
         return sumYY;
     }
+    
+    /**
+     * Returns the sum of squared deviations of the x values about their mean.
+     *
+     * If <code>n < 2</code>, this returns <code>Double.NaN</code>.</p>
+     *
+     * @return sum of squared deviations of x values
+     */
+    public double getXSumSquares() {
+        if (n < 2) {
+            return Double.NaN;
+        }
+        return sumXX;
+    }
+    
+    /**
+     * Returns the sum of crossproducts, x<sub>i</sub>*y<sub>i</sub>.
+     *
+     * @return sum of cross products
+     */
+    public double getSumOfCrossProducts() {
+        return sumXY;
+    }
 
     /**
      * Returns the sum of squared deviations of the predicted y values about