本文整理汇总了Java中org.apache.commons.math3.special.Gamma.regularizedGammaP方法的典型用法代码示例。如果您正苦于以下问题:Java Gamma.regularizedGammaP方法的具体用法?Java Gamma.regularizedGammaP怎么用?Java Gamma.regularizedGammaP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math3.special.Gamma
的用法示例。
在下文中一共展示了Gamma.regularizedGammaP方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cumulativeProbability
import org.apache.commons.math3.special.Gamma; //导入方法依赖的package包/类
/**
* {@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;
}
示例2: pValue
import org.apache.commons.math3.special.Gamma; //导入方法依赖的package包/类
public static double pValue(double chiSquared, long nbDegreesOfFreedom, double epsilon) {
if (chiSquared <= 0.0) {
return 1.0;
} else {
return 1.0 - Gamma.regularizedGammaP(nbDegreesOfFreedom / 2.0, chiSquared / 2.0, epsilon, Integer.MAX_VALUE);
}
}
示例3: apply
import org.apache.commons.math3.special.Gamma; //导入方法依赖的package包/类
@Override
public Double apply(Double x) {
try {
return Gamma.regularizedGammaP(_a, x, _eps, _maxIter);
} catch (MaxCountExceededException e) {
throw new MathException(e);
}
}
示例4: cumulativeProbability
import org.apache.commons.math3.special.Gamma; //导入方法依赖的package包/类
/** {@inheritDoc} */
public double cumulativeProbability(double x) {
return Gamma.regularizedGammaP(mu, mu * x * x / omega);
}
示例5: getCDF
import org.apache.commons.math3.special.Gamma; //导入方法依赖的package包/类
/**
* {@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;
}
示例6: cumulativeProbability
import org.apache.commons.math3.special.Gamma; //导入方法依赖的package包/类
/**
* {@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;
}
示例7: cumulativeProbability
import org.apache.commons.math3.special.Gamma; //导入方法依赖的package包/类
/**
* {@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;
}
示例8: computePValue
import org.apache.commons.math3.special.Gamma; //导入方法依赖的package包/类
/**
* Compute the p-value of the Chi-squared distribution. This is the cumulative probability of the chi-squared
* distribution.
* <p>
* This is the probability of obtaining a value less extreme than this point by chance.
*
* @param chiSquared
* the chi squared
* @param degreesOfFreedom
* the degrees of freedom
* @return the p-value
*/
public static double computePValue(double chiSquared, int degreesOfFreedom)
{
if (chiSquared <= 0)
{
return 0;
}
else
{
return Gamma.regularizedGammaP(degreesOfFreedom / 2.0, chiSquared / 2.0);
}
}