List of usage examples for org.apache.commons.math.distribution ContinuousDistribution inverseCumulativeProbability
double inverseCumulativeProbability(double p) throws MathException;
From source file:org.renjin.Distributions.java
/** * Calculates the value of the inverse cumulative probability function according to standard R arguments. * * @param dist the continuous distribution * @param p the probability// w w w. j a v a2 s. c om * @param lowerTail * @param logP if true, interpret {@code p} as the natural logarithm of the probability * @return the value fo */ private static double q(ContinuousDistribution dist, double p, boolean lowerTail, boolean logP) { if (logP) { p = Math.exp(p); } double q = 0; try { q = dist.inverseCumulativeProbability(p); } catch (IllegalArgumentException e) { return Double.NaN; } catch (MathException e) { return Double.NaN; } catch (MathRuntimeException e) { return Double.NaN; } if (!lowerTail) { q = -q; } return q; }