Java Code Examples for org.apache.commons.math3.special.Erf#erfcInv()
The following examples show how to use
org.apache.commons.math3.special.Erf#erfcInv() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QuadraticQFunction.java From OSPREY3 with GNU General Public License v2.0 | 5 votes |
private static double myErfcInv(double z){ //erfcInv maxes out too early. But I noticed that for x=4 to 27 (and probably much higher), // ln(erfc(x)) = -0.997021118x^2 - 0.166032837x - 1.474007920 // with R² = 0.999999967 //so we'll use that when regular erfcInv is infinite (or close to it) if(z>1) return -myErfcInv(2-z); if(z>1e-15)//I think Erf.erfcInv should be OK in this range return Erf.erfcInv(z); else return quadApproxErfcInv(z); }
Example 2
Source File: LevyDistribution.java From astor with GNU General Public License v2.0 | 5 votes |
/** {@inheritDoc} */ @Override public double inverseCumulativeProbability(final double p) throws OutOfRangeException { if (p < 0.0 || p > 1.0) { throw new OutOfRangeException(p, 0, 1); } final double t = Erf.erfcInv(p); return mu + halfC / (t * t); }
Example 3
Source File: LevyDistribution.java From astor with GNU General Public License v2.0 | 5 votes |
/** {@inheritDoc} */ @Override public double inverseCumulativeProbability(final double p) throws OutOfRangeException { if (p < 0.0 || p > 1.0) { throw new OutOfRangeException(p, 0, 1); } final double t = Erf.erfcInv(p); return mu + halfC / (t * t); }
Example 4
Source File: LevyDistribution.java From astor with GNU General Public License v2.0 | 5 votes |
/** {@inheritDoc} */ @Override public double inverseCumulativeProbability(final double p) throws OutOfRangeException { if (p < 0.0 || p > 1.0) { throw new OutOfRangeException(p, 0, 1); } final double t = Erf.erfcInv(p); return mu + halfC / (t * t); }
Example 5
Source File: LevyDistribution.java From astor with GNU General Public License v2.0 | 5 votes |
/** {@inheritDoc} */ @Override public double inverseCumulativeProbability(final double p) throws OutOfRangeException { if (p < 0.0 || p > 1.0) { throw new OutOfRangeException(p, 0, 1); } final double t = Erf.erfcInv(p); return mu + halfC / (t * t); }
Example 6
Source File: LevyDistribution.java From astor with GNU General Public License v2.0 | 5 votes |
/** {@inheritDoc} */ @Override public double inverseCumulativeProbability(final double p) throws OutOfRangeException { if (p < 0.0 || p > 1.0) { throw new OutOfRangeException(p, 0, 1); } final double t = Erf.erfcInv(p); return mu + halfC / (t * t); }
Example 7
Source File: GrowthChart.java From synthea with Apache License 2.0 | 3 votes |
/** * Z is the z-score that corresponds to the percentile. * z-scores correspond exactly to percentiles, e.g., * z-scores of: * -1.881, // 3rd * -1.645, // 5th * -1.282, // 10th * -0.674, // 25th * 0, // 50th * 0.674, // 75th * 1.036, // 85th * 1.282, // 90th * 1.645, // 95th * 1.881 // 97th * @param percentile 0.0 - 1.0 * @return z-score that corresponds to the percentile. */ public static double calculateZScore(double percentile) { // Set percentile gt0 and lt1, otherwise the error // function will return Infinity. if (percentile >= 1.0) { percentile = 0.999; } else if (percentile <= 0.0) { percentile = 0.001; } return -1 * Math.sqrt(2) * Erf.erfcInv(2 * percentile); }