当前位置: 首页>>代码示例>>Java>>正文


Java RealDistribution.inverseCumulativeProbability方法代码示例

本文整理汇总了Java中org.apache.commons.math3.distribution.RealDistribution.inverseCumulativeProbability方法的典型用法代码示例。如果您正苦于以下问题:Java RealDistribution.inverseCumulativeProbability方法的具体用法?Java RealDistribution.inverseCumulativeProbability怎么用?Java RealDistribution.inverseCumulativeProbability使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.math3.distribution.RealDistribution的用法示例。


在下文中一共展示了RealDistribution.inverseCumulativeProbability方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calculateBoundaries

import org.apache.commons.math3.distribution.RealDistribution; //导入方法依赖的package包/类
private double[] calculateBoundaries() {
    RealDistribution distribution = createDistribution();

    double[] result = new double[numBins];
    for (int i = 0; i < numBins; i++) {
        double p = 1.0 * (i + 1) / numBins;
        result[i] = distribution.inverseCumulativeProbability(p);
    }

    return result;
}
 
开发者ID:komiya-atsushi,项目名称:fast-rng-java,代码行数:12,代码来源:RNGTester.java

示例2: inverseCumulativeProbability

import org.apache.commons.math3.distribution.RealDistribution; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 *
 * <p>Algorithm description:<ol>
 * <li>Find the smallest i such that the sum of the masses of the bins
 *  through i is at least p.</li>
 * <li>
 *   Let K be the within-bin kernel distribution for bin i.</br>
 *   Let K(B) be the mass of B under K. <br/>
 *   Let K(B-) be K evaluated at the lower endpoint of B (the combined
 *   mass of the bins below B under K).<br/>
 *   Let P(B) be the probability of bin i.<br/>
 *   Let P(B-) be the sum of the bin masses below bin i. <br/>
 *   Let pCrit = p - P(B-)<br/>
 * <li>Return the inverse of K evaluated at <br/>
 *    K(B-) + pCrit * K(B) / P(B) </li>
 *  </ol></p>
 *
 * @since 3.1
 */
@Override
public double inverseCumulativeProbability(final double p) throws OutOfRangeException {
    if (p < 0.0 || p > 1.0) {
        throw new OutOfRangeException(p, 0, 1);
    }

    if (p == 0.0) {
        return getSupportLowerBound();
    }

    if (p == 1.0) {
        return getSupportUpperBound();
    }

    int i = 0;
    while (cumBinP(i) < p) {
        i++;
    }

    final RealDistribution kernel = getKernel(binStats.get(i));
    final double kB = kB(i);
    final double[] binBounds = getUpperBounds();
    final double lower = i == 0 ? min : binBounds[i - 1];
    final double kBminus = kernel.cumulativeProbability(lower);
    final double pB = pB(i);
    final double pBminus = pBminus(i);
    final double pCrit = p - pBminus;
    if (pCrit <= 0) {
        return lower;
    }
    return kernel.inverseCumulativeProbability(kBminus + pCrit * kB / pB);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:53,代码来源:EmpiricalDistribution.java

示例3: getDistributionQuartiles

import org.apache.commons.math3.distribution.RealDistribution; //导入方法依赖的package包/类
/**
 * Computes the 25th, 50th and 75th percentiles of the given distribution and returns
 * these values in an array.
 */
public static double[] getDistributionQuartiles(RealDistribution distribution) {
    double[] quantiles = new double[3];
    quantiles[0] = distribution.inverseCumulativeProbability(0.25d);
    quantiles[1] = distribution.inverseCumulativeProbability(0.5d);
    quantiles[2] = distribution.inverseCumulativeProbability(0.75d);
    return quantiles;
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:12,代码来源:TestUtils.java

示例4: nextInversionDeviate

import org.apache.commons.math3.distribution.RealDistribution; //导入方法依赖的package包/类
/**
 * Generate a random deviate from the given distribution using the
 * <a href="http://en.wikipedia.org/wiki/Inverse_transform_sampling"> inversion method.</a>
 *
 * @param distribution Continuous distribution to generate a random value from
 * @return a random value sampled from the given distribution
 * @throws MathIllegalArgumentException if the underlynig distribution throws one
 * @since 2.2
 * @deprecated use the distribution's sample() method
 */
@Deprecated
public double nextInversionDeviate(RealDistribution distribution)
    throws MathIllegalArgumentException {
    return distribution.inverseCumulativeProbability(nextUniform(0, 1));

}
 
开发者ID:biocompibens,项目名称:SME,代码行数:17,代码来源:RandomDataImpl.java

示例5: nextInversionDeviate

import org.apache.commons.math3.distribution.RealDistribution; //导入方法依赖的package包/类
/**
 * Generate a random deviate from the given distribution using the
 * <a href="http://en.wikipedia.org/wiki/Inverse_transform_sampling"> inversion method.</a>
 *
 * @param distribution Continuous distribution to generate a random value from
 * @return a random value sampled from the given distribution
 * @since 2.2
 */
public double nextInversionDeviate(RealDistribution distribution) {
    return distribution.inverseCumulativeProbability(nextUniform(0, 1));

}
 
开发者ID:golharam,项目名称:FastQC,代码行数:13,代码来源:RandomDataImpl.java

示例6: nextInversionDeviate

import org.apache.commons.math3.distribution.RealDistribution; //导入方法依赖的package包/类
/**
 * Generate a random deviate from the given distribution using the
 * <a href="http://en.wikipedia.org/wiki/Inverse_transform_sampling"> inversion method.</a>
 *
 * @param distribution Continuous distribution to generate a random value from
 * @return a random value sampled from the given distribution
 * @throws MathIllegalArgumentException if the underlynig distribution throws one 
 * @since 2.2
 * @deprecated use the distribution's sample() method
 */
public double nextInversionDeviate(RealDistribution distribution)
    throws MathIllegalArgumentException {
    return distribution.inverseCumulativeProbability(nextUniform(0, 1));

}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:16,代码来源:RandomDataImpl.java


注:本文中的org.apache.commons.math3.distribution.RealDistribution.inverseCumulativeProbability方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。