本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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));
}
示例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));
}
示例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));
}