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

MultipleLinearRegression - test for minimum number of samples

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0
    • 2.0
    • None
    • 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

            luc Luc Maisonobe
            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