Java Code Examples for org.apache.commons.math3.special.Gamma#regularizedGammaP()
The following examples show how to use
org.apache.commons.math3.special.Gamma#regularizedGammaP() .
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: IncompleteGammaFunction.java From Strata with Apache License 2.0 | 5 votes |
@Override public Double apply(Double x) { try { return Gamma.regularizedGammaP(_a, x, _eps, _maxIter); } catch (MaxCountExceededException e) { throw new MathException(e); } }
Example 2
Source File: NakagamiDistribution.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public double cumulativeProbability(double x) { return Gamma.regularizedGammaP(mu, mu * x * x / omega); }
Example 3
Source File: NakagamiDistribution.java From astor with GNU General Public License v2.0 | 4 votes |
/** {@inheritDoc} */ public double cumulativeProbability(double x) { return Gamma.regularizedGammaP(mu, mu * x * x / omega); }
Example 4
Source File: NonCentralChiSquaredDistribution.java From Strata with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public double getCDF(Double x) { ArgChecker.notNull(x, "x"); if (x < 0) { return 0.0; } if ((_dofOverTwo + _lambdaOverTwo) > 1000) { return getFraserApproxCDF(x); } double regGammaStart = 0; double halfX = x / 2.0; double logX = Math.log(halfX); try { regGammaStart = Gamma.regularizedGammaP(_dofOverTwo + _k, halfX); } catch (MaxCountExceededException ex) { throw new MathException(ex); } double sum = _pStart * regGammaStart; double oldSum = Double.NEGATIVE_INFINITY; double p = _pStart; double regGamma = regGammaStart; double temp; int i = _k; // first add terms below _k while (i > 0 && Math.abs(sum - oldSum) / sum > _eps) { i--; p *= (i + 1) / _lambdaOverTwo; temp = (_dofOverTwo + i) * logX - halfX - Gamma.logGamma(_dofOverTwo + i + 1); regGamma += Math.exp(temp); oldSum = sum; sum += p * regGamma; } p = _pStart; regGamma = regGammaStart; oldSum = Double.NEGATIVE_INFINITY; i = _k; while (Math.abs(sum - oldSum) / sum > _eps) { i++; p *= _lambdaOverTwo / i; temp = (_dofOverTwo + i - 1) * logX - halfX - Gamma.logGamma(_dofOverTwo + i); regGamma -= Math.exp(temp); oldSum = sum; sum += p * regGamma; } return sum; }
Example 5
Source File: GammaDistribution.java From astor with GNU General Public License v2.0 | 3 votes |
/** * {@inheritDoc} * * The implementation of this method is based on: * <ul> * <li> * <a href="http://mathworld.wolfram.com/Chi-SquaredDistribution.html"> * Chi-Squared Distribution</a>, equation (9). * </li> * <li>Casella, G., & Berger, R. (1990). <i>Statistical Inference</i>. * Belmont, CA: Duxbury Press. * </li> * </ul> */ public double cumulativeProbability(double x) { double ret; if (x <= 0) { ret = 0; } else { ret = Gamma.regularizedGammaP(shape, x / scale); } return ret; }
Example 6
Source File: GammaDistribution.java From astor with GNU General Public License v2.0 | 3 votes |
/** * {@inheritDoc} * * The implementation of this method is based on: * <ul> * <li> * <a href="http://mathworld.wolfram.com/Chi-SquaredDistribution.html"> * Chi-Squared Distribution</a>, equation (9). * </li> * <li>Casella, G., & Berger, R. (1990). <i>Statistical Inference</i>. * Belmont, CA: Duxbury Press. * </li> * </ul> */ public double cumulativeProbability(double x) { double ret; if (x <= 0) { ret = 0; } else { ret = Gamma.regularizedGammaP(shape, x / scale); } return ret; }
Example 7
Source File: GammaDistribution.java From astor with GNU General Public License v2.0 | 3 votes |
/** * {@inheritDoc} * * The implementation of this method is based on: * <ul> * <li> * <a href="http://mathworld.wolfram.com/Chi-SquaredDistribution.html"> * Chi-Squared Distribution</a>, equation (9). * </li> * <li>Casella, G., & Berger, R. (1990). <i>Statistical Inference</i>. * Belmont, CA: Duxbury Press. * </li> * </ul> */ public double cumulativeProbability(double x) { double ret; if (x <= 0) { ret = 0; } else { ret = Gamma.regularizedGammaP(shape, x / scale); } return ret; }
Example 8
Source File: GammaDistribution.java From astor with GNU General Public License v2.0 | 3 votes |
/** * {@inheritDoc} * * The implementation of this method is based on: * <ul> * <li> * <a href="http://mathworld.wolfram.com/Chi-SquaredDistribution.html"> * Chi-Squared Distribution</a>, equation (9). * </li> * <li>Casella, G., & Berger, R. (1990). <i>Statistical Inference</i>. * Belmont, CA: Duxbury Press. * </li> * </ul> */ public double cumulativeProbability(double x) { double ret; if (x <= 0) { ret = 0; } else { ret = Gamma.regularizedGammaP(shape, x / scale); } return ret; }
Example 9
Source File: GammaDistribution.java From astor with GNU General Public License v2.0 | 3 votes |
/** * {@inheritDoc} * * The implementation of this method is based on: * <ul> * <li> * <a href="http://mathworld.wolfram.com/Chi-SquaredDistribution.html"> * Chi-Squared Distribution</a>, equation (9). * </li> * <li>Casella, G., & Berger, R. (1990). <i>Statistical Inference</i>. * Belmont, CA: Duxbury Press. * </li> * </ul> */ public double cumulativeProbability(double x) { double ret; if (x <= 0) { ret = 0; } else { ret = Gamma.regularizedGammaP(alpha, x / beta); } return ret; }
Example 10
Source File: GammaDistribution.java From astor with GNU General Public License v2.0 | 3 votes |
/** * {@inheritDoc} * * The implementation of this method is based on: * <ul> * <li> * <a href="http://mathworld.wolfram.com/Chi-SquaredDistribution.html"> * Chi-Squared Distribution</a>, equation (9). * </li> * <li>Casella, G., & Berger, R. (1990). <i>Statistical Inference</i>. * Belmont, CA: Duxbury Press. * </li> * </ul> */ public double cumulativeProbability(double x) { double ret; if (x <= 0) { ret = 0; } else { ret = Gamma.regularizedGammaP(shape, x / scale); } return ret; }
Example 11
Source File: GammaDistribution.java From astor with GNU General Public License v2.0 | 3 votes |
/** * {@inheritDoc} * * The implementation of this method is based on: * <ul> * <li> * <a href="http://mathworld.wolfram.com/Chi-SquaredDistribution.html"> * Chi-Squared Distribution</a>, equation (9). * </li> * <li>Casella, G., & Berger, R. (1990). <i>Statistical Inference</i>. * Belmont, CA: Duxbury Press. * </li> * </ul> */ public double cumulativeProbability(double x) { double ret; if (x <= 0) { ret = 0; } else { ret = Gamma.regularizedGammaP(shape, x / scale); } return ret; }
Example 12
Source File: GammaDistribution.java From astor with GNU General Public License v2.0 | 3 votes |
/** * {@inheritDoc} * * The implementation of this method is based on: * <ul> * <li> * <a href="http://mathworld.wolfram.com/Chi-SquaredDistribution.html"> * Chi-Squared Distribution</a>, equation (9). * </li> * <li>Casella, G., & Berger, R. (1990). <i>Statistical Inference</i>. * Belmont, CA: Duxbury Press. * </li> * </ul> */ public double cumulativeProbability(double x) { double ret; if (x <= 0) { ret = 0; } else { ret = Gamma.regularizedGammaP(shape, x / scale); } return ret; }