commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Bjorkegren (JIRA)" <j...@apache.org>
Subject [jira] Created: (MATH-279) MultipleLinearRegression - test for minimum number of samples
Date Sat, 20 Jun 2009 07:14:07 GMT
MultipleLinearRegression - test for minimum number of samples
-------------------------------------------------------------

                 Key: MATH-279
                 URL: https://issues.apache.org/jira/browse/MATH-279
             Project: Commons Math
          Issue Type: Bug
    Affects Versions: 2.0
            Reporter: Michael Bjorkegren
            Priority: Minor
             Fix For: 2.0


It's currently possible to pass in so few rows (samples) that there isn't a row for each column
(predictor).  Does this look like the right thing to do?

{code}
Index: AbstractMultipleLinearRegression.java
===================================================================
--- AbstractMultipleLinearRegression.java       (revision 786758)
+++ AbstractMultipleLinearRegression.java       (working copy)
@@ -91,6 +91,9 @@
                   "dimension mismatch {0} != {1}",
                   (x == null) ? 0 : x.length,
                   (y == null) ? 0 : y.length);
+        } else if (x[0].length > x.length){
+            throw MathRuntimeException.createIllegalArgumentException(
+                    "not enough data (" + x.length + " rows) for this many predictors ("
+ x[0].length + " predictors)");
         }
     }
 {code}



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message