Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-279

MultipleLinearRegression - test for minimum number of samples

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Labels:
      None

      Description

      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?

      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)");
               }
           }
       

        Attachments

          Activity

            People

            • Assignee:
              luc Luc Maisonobe
              Reporter:
              mbjorkegren Michael Bjorkegren
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 10m
                10m
                Remaining:
                Remaining Estimate - 10m
                10m
                Logged:
                Time Spent - Not Specified
                Not Specified