commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r742145 - /commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/SimpleRegression.java
Date Sun, 08 Feb 2009 19:30:09 GMT
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 



Mime
View raw message