本文整理汇总了Java中org.apache.commons.math.special.Beta类的典型用法代码示例。如果您正苦于以下问题:Java Beta类的具体用法?Java Beta怎么用?Java Beta使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Beta类属于org.apache.commons.math.special包,在下文中一共展示了Beta类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: cdf
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
public static double cdf(double x, double mean, double alpha) {
double theta = 1.0 / alpha;
double p = theta / (theta + mean);
try {
return Beta.regularizedBeta(p, theta, 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());
}
}
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:14,代码来源:NegativeBinomialDistribution.java
示例2: cumulativeProbability
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
/**
* For this disbution, X, this method returns P(X < <code>x</code>).
* @param x the value at which the CDF is evaluated.
* @return CDF evaluted at <code>x</code>.
* @throws MathException if the cumulative probability can not be
* computed due to convergence or other numerical errors.
*/
public double cumulativeProbability(double x) throws MathException{
double ret;
if (x == 0.0) {
ret = 0.5;
} else {
double t =
Beta.regularizedBeta(
getDegreesOfFreedom() / (getDegreesOfFreedom() + (x * x)),
0.5 * getDegreesOfFreedom(),
0.5);
if (x < 0.0) {
ret = 0.5 * t;
} else {
ret = 1.0 - 0.5 * t;
}
}
return ret;
}
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:27,代码来源:TDistributionImpl.java
示例3: cumulativeProbability
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
/**
* For this distribution, X, this method returns P(X ≤ x).
* @param x the value at which the PDF is evaluated.
* @return PDF for this distribution.
* @throws MathException if the cumulative probability can not be
* computed due to convergence or other numerical errors.
*/
public double cumulativeProbability(int x) throws MathException {
double ret;
if (x < 0) {
ret = 0.0;
} else if (x >= getNumberOfTrials()) {
ret = 1.0;
} else {
ret =
1.0 - Beta.regularizedBeta(
getProbabilityOfSuccess(),
x + 1.0,
getNumberOfTrials() - x);
}
return ret;
}
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:23,代码来源:BinomialDistributionImpl.java
示例4: cdf
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
public double cdf(double x) {
if (x <= 0) {
return 0;
} else if (x >= 1) {
return 1;
} else {
try {
return Beta.regularizedBeta(x, alpha, beta);
} 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());
}
}
}
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:19,代码来源:BetaDistribution.java
示例5: getDescendingCumulativeProbabilityAt
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
@Override
public Double getDescendingCumulativeProbabilityAt(double x) throws MathException {
int k = (int) x;
if (k > n) {
return 0.0;
} else if (k < 0) {
return 1.0;
}
Double result = pCache.get(k);
if (result == null) {
// adapted from http://commons.apache.org/proper/commons-math/apidocs/src-html/org/apache/commons/math3/distribution/BinomialDistribution.html#line.130
result = Beta.regularizedBeta(p, x + 1.0, n - x);
addDescendingCumulativePToCache(k, result);
}
return result;
}
开发者ID:compomics,项目名称:compomics-utilities,代码行数:19,代码来源:BinomialDistribution.java
示例6: cumulativeProbability
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
/**
* For this distribution, X, this method returns P(X < <code>x</code>).
*
* @param x the value at which the CDF is evaluated.
* @return CDF evaluted at <code>x</code>.
* @throws MathException if the cumulative probability can not be
* computed due to convergence or other numerical errors.
*/
@Override
public double cumulativeProbability(double x) throws MathException {
double ret;
if (x == 0.0) {
ret = 0.5;
} else {
double t =
Beta.regularizedBeta(
degreesOfFreedom / (degreesOfFreedom + (x * x)),
0.5 * degreesOfFreedom,
0.5);
if (x < 0.0) {
ret = 0.5 * t;
} else {
ret = 1.0 - 0.5 * t;
}
}
return ret;
}
开发者ID:CompEvol,项目名称:beast2,代码行数:29,代码来源:TDistributionImpl.java
示例7: cumulativeProbability
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
/**
* For this distribution, X, this method returns P(X < x).
* <p/>
* The implementation of this method is based on:
* <ul>
* <li>
* <a href="http://mathworld.wolfram.com/F-Distribution.html">
* F-Distribution</a>, equation (4).</li>
* </ul>
*
* @param x the value at which the CDF is evaluated.
* @return CDF for this distribution.
* @throws MathException if the cumulative probability can not be
* computed due to convergence or other numerical errors.
*/
@Override
public double cumulativeProbability(double x) throws MathException {
double ret;
if (x <= 0.0) {
ret = 0.0;
} else {
double n = numeratorDegreesOfFreedom;
double m = denominatorDegreesOfFreedom;
ret = Beta.regularizedBeta((n * x) / (m + n * x),
0.5 * n,
0.5 * m);
}
return ret;
}
开发者ID:CompEvol,项目名称:beast2,代码行数:31,代码来源:FDistributionImpl.java
示例8: cumulativeProbability
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
/**
* For this distribution, X, this method returns P(X < <code>x</code>).
* @param x the value at which the CDF is evaluated.
* @return CDF evaluted at <code>x</code>.
* @throws MathException if the cumulative probability can not be
* computed due to convergence or other numerical errors.
*/
public double cumulativeProbability(double x) throws MathException{
double ret;
if (x == 0.0) {
ret = 0.5;
} else {
double t =
Beta.regularizedBeta(
getDegreesOfFreedom() / (getDegreesOfFreedom() + (x * x)),
0.5 * getDegreesOfFreedom(),
0.5);
if (x < 0.0) {
ret = 0.5 * t;
} else {
ret = 1.0 - 0.5 * t;
}
}
return ret;
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:27,代码来源:TDistributionImpl.java
示例9: cumulativeProbability
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
/**
* For this distribution, X, this method returns {@code P(X < x}).
*
* @param x Value at which the CDF is evaluated.
* @return CDF evaluated at {@code x}.
* @throws MathException if the cumulative probability can not be
* computed due to convergence or other numerical errors.
*/
public double cumulativeProbability(double x) throws MathException{
double ret;
if (x == 0) {
ret = 0.5;
} else {
double t =
Beta.regularizedBeta(
degreesOfFreedom / (degreesOfFreedom + (x * x)),
0.5 * degreesOfFreedom,
0.5);
if (x < 0.0) {
ret = 0.5 * t;
} else {
ret = 1.0 - 0.5 * t;
}
}
return ret;
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:28,代码来源:TDistributionImpl.java
示例10: cumulativeProbability
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
/**
* For this distribution, X, this method returns P(X < <code>x</code>).
* @param x the value at which the CDF is evaluated.
* @return CDF evaluted at <code>x</code>.
* @throws MathException if the cumulative probability can not be
* computed due to convergence or other numerical errors.
*/
public double cumulativeProbability(double x) throws MathException{
double ret;
if (x == 0.0) {
ret = 0.5;
} else {
double t =
Beta.regularizedBeta(
degreesOfFreedom / (degreesOfFreedom + (x * x)),
0.5 * degreesOfFreedom,
0.5);
if (x < 0.0) {
ret = 0.5 * t;
} else {
ret = 1.0 - 0.5 * t;
}
}
return ret;
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:27,代码来源:TDistributionImpl.java
示例11: cumulativeProbability
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
/**
* For this distribution, X, this method returns P(X < <code>x</code>).
* @param x the value at which the CDF is evaluated.
* @return CDF evaluted at <code>x</code>.
* @throws MathException if the cumulative probability can not be
* computed due to convergence or other numerical errors.
*/
public double cumulativeProbability(double x) throws MathException{
double ret;
if (x == 0.0) {
ret = 0.5;
} else {
double t =
Beta.regularizedBeta(
getDegreesOfFreedom() / (getDegreesOfFreedom() + (x * x)),
0.5 * getDegreesOfFreedom(),
0.5);
if (x < 0.0) {
ret = 0.5 * t;
} else {
ret = 1.0 - 0.5 * t;
}
}
return ret;
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:27,代码来源:TDistributionImpl.java
示例12: cumulativeProbability
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
/**
* For this distribution, X, this method returns P(X ≤ x).
* @param x the value at which the PDF is evaluated.
* @return PDF for this distribution.
* @throws MathException if the cumulative probability can not be
* computed due to convergence or other numerical errors.
*/
@Override
public double cumulativeProbability(int x) throws MathException {
double ret;
if (x < 0) {
ret = 0.0;
} else if (x >= getNumberOfTrials()) {
ret = 1.0;
} else {
ret =
1.0 - Beta.regularizedBeta(
getProbabilityOfSuccess(),
x + 1.0,
getNumberOfTrials() - x);
}
return ret;
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:24,代码来源:BinomialDistributionImpl.java
示例13: cumulativeProbability
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
/**
* For this distribution, X, this method returns P(X < <code>x</code>).
*
* @param x the value at which the CDF is evaluated.
* @return CDF evaluted at <code>x</code>.
* @throws MathException if the cumulative probability can not be
* computed due to convergence or other numerical errors.
*/
public double cumulativeProbability(double x) throws MathException {
double ret;
if (x == 0.0) {
ret = 0.5;
} else {
double t =
Beta.regularizedBeta(
degreesOfFreedom / (degreesOfFreedom + (x * x)),
0.5 * degreesOfFreedom,
0.5);
if (x < 0.0) {
ret = 0.5 * t;
} else {
ret = 1.0 - 0.5 * t;
}
}
return ret;
}
开发者ID:rbouckaert,项目名称:YABBY,代码行数:28,代码来源:TDistributionImpl.java
示例14: evaluate
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
/**
* @param x x
* @return the value of the function
* @throws IllegalArgumentException If $x < 0$ or $x > 1$
*/
@Override
public Double evaluate(final Double x) {
Validate.isTrue(x >= 0 && x <= 1, "x must be in the range 0 to 1");
try {
return Beta.regularizedBeta(x, _a, _b, _eps, _maxIter);
} catch (final org.apache.commons.math.MathException e) {
throw new MathException(e);
}
}
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:15,代码来源:IncompleteBetaFunction.java
示例15: cumulativeProbability
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
/**
* For this distribution, X, this method returns P(X ≤ x).
* @param x the value at which the PDF is evaluated
* @return PDF for this distribution
* @throws MathException if the cumulative probability can not be computed
* due to convergence or other numerical errors
*/
public double cumulativeProbability(int x) throws MathException {
double ret;
if (x < 0) {
ret = 0.0;
} else {
ret = Beta.regularizedBeta(getProbabilityOfSuccess(),
getNumberOfSuccesses(), x + 1);
}
return ret;
}
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:18,代码来源:PascalDistributionImpl.java
示例16: cumulativeProbability
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
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);
}
}
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:10,代码来源:BetaDistribution.java
示例17: quantile
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
public double quantile(double y) {
// TB - I'm having trouble implementing this
// LM - A first stab using simple minimisation to invert the function (under absolute loss)
// Implementation based on the qnbinom.c function used in R
final double stdev = Math.sqrt(mean + (mean * mean * alpha));
final double r = -1 * (mean*mean) / (mean - stdev*stdev);
final double p = mean / (stdev*stdev);
final double prob = y;
final double Q = 1.0 / p;
final double P = (1.0 - p) * Q;
final double gamma = (Q + P)/stdev;
final double z = Math.sqrt(2.0) * ErrorFunction.inverseErf(2.0 * y - 1.0);
final double crudeY = mean + stdev * (z + gamma * (z*z - 1) / 6);
UnivariateFunction f = new UnivariateFunction() {
double tent = Double.NaN;
public double evaluate(final double argument) {
try {
tent = Beta.regularizedBeta(p, r, argument+1);
} catch (MathException e) {
return Double.NaN;
}
double score = Math.abs(tent-prob);
return score;
}
public int getNumArguments() {
return 1;
}
public double getLowerBound() { // 20% window should cut it. Probably too large even...
return Math.min(crudeY - .2*crudeY, 0);
}
public double getUpperBound() {
return crudeY + .2*crudeY;
}
};
UnivariateMinimum minimum = new UnivariateMinimum();
double q = minimum.findMinimum(f);
return Math.ceil(q);
}
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:41,代码来源:NegativeBinomialDistribution.java
示例18: cumulativeProbability
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
/**
* {@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);
}
}
开发者ID:CompEvol,项目名称:beast2,代码行数:14,代码来源:BetaDistributionImpl.java
示例19: cumulativeProbability
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
/**
* For this distribution, X, this method returns P(X ≤ x).
*
* @param x the value at which the PDF is evaluated
* @return PDF for this distribution
* @throws MathException if the cumulative probability can not be computed
* due to convergence or other numerical errors
*/
@Override
public double cumulativeProbability(int x) throws MathException {
double ret;
if (x < 0) {
ret = 0.0;
} else {
ret = Beta.regularizedBeta(probabilityOfSuccess,
numberOfSuccesses, x + 1);
}
return ret;
}
开发者ID:CompEvol,项目名称:beast2,代码行数:20,代码来源:PascalDistributionImpl.java
示例20: cumulativeProbability
import org.apache.commons.math.special.Beta; //导入依赖的package包/类
/**
* For this distribution, X, this method returns P(X ≤ x).
*
* @param x the value at which the PDF is evaluated.
* @return PDF for this distribution.
* @throws MathException if the cumulative probability can not be computed
* due to convergence or other numerical errors.
*/
@Override
public double cumulativeProbability(int x) throws MathException {
double ret;
if (x < 0) {
ret = 0.0;
} else if (x >= numberOfTrials) {
ret = 1.0;
} else {
ret = 1.0 - Beta.regularizedBeta(getProbabilityOfSuccess(),
x + 1.0, numberOfTrials - x);
}
return ret;
}
开发者ID:CompEvol,项目名称:beast2,代码行数:22,代码来源:BinomialDistributionImpl.java
注:本文中的org.apache.commons.math.special.Beta类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论