/** {@inheritDoc} */
 @Override
 public double cumulativeProbability(double x) throws MathException {
   if (x <= 0) {
     return 0;
   } else if (x >= 1) {
     return 1;
   } else {
     return Beta.regularizedBeta(x, alpha, beta);
   }
 }
 public double cdf(double x) {
   double r = -1 * (mean * mean) / (mean - stdev * stdev);
   double p = mean / (stdev * stdev);
   try {
     return Beta.regularizedBeta(p, r, x + 1);
   } catch (MathException e) {
     // AR - throwing exceptions deep in numerical code causes trouble. Catching runtime
     // exceptions is bad. Better to return NaN and let the calling code deal with it.
     return Double.NaN;
     //                throw MathRuntimeException.createIllegalArgumentException(
     //                "Couldn't calculate beta cdf for alpha = " + alpha + ", beta = " + beta + ":
     // " +e.getMessage());
   }
 }