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

EmpiricalDistribution cumulativeProbability can return NaN when evaluated within an empty bin.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.6.1
    • 4.0
    • None
    • None
    • Important

    Description

      The NaN can be reproduced by the following program. Evaluating at x = 0.3, it appeared that getkernel returned a NormalDistribution with mean of NaN and standardDeviation of NaN.

          final int len = 240000;
          double[] data = new double[len];
          for (int i = 0; i < len / 2; ++i) {
              data[i] = 0;
          }
          for (int i = len / 2 + 1; i < len ; ++i) {
              data[i] = 1;
          }
      
          int binCnt = Math.max(1, data.length / 10);
          EmpiricalDistribution edist = new EmpiricalDistribution(binCnt);
          edist.load(data);
          double x = 0.3;
          double y = edist.cumulativeProbability(x);
          System.out.println("y is " + y);
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jlin61 Jay
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: