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


Java NormalDistribution.inverseCumulativeProbability方法代码示例

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


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

示例1: solveLognormalNewsvendor

import org.apache.commons.math3.distribution.NormalDistribution; //导入方法依赖的package包/类
public static Newsvendor solveLognormalNewsvendor (final double price, final double cost, final double mu, final double sigma) {
	final NormalDistribution dist1 = new NormalDistribution();
	final double cv = sigma/mu;
	final double nu = Math.log(mu)-Math.log(Math.sqrt(1+cv*cv));
	final double tau = Math.sqrt(Math.log(1+cv*cv));
	final LogNormalDistribution dist2 = new LogNormalDistribution(nu,tau);
	return new Newsvendor(price,cost) {{
		_safetyfactor = dist1.inverseCumulativeProbability((price-cost)/price);
		_quantity = Math.exp(nu+tau*_safetyfactor);
		_profit = (price-cost)*mu - price*mu*dist1.cumulativeProbability(tau-_safetyfactor)+cost*mu;
	}
	@Override
	public double getProfit(double quantity) {
		double lostSales = quantity*(1-dist2.cumulativeProbability(quantity))-Math.exp(nu+tau*tau/2)*dist1.cumulativeProbability((nu+tau*tau-Math.log(quantity))/tau);
		return _price*mu -_cost*quantity + _price*lostSales;
	}
	};
}
 
开发者ID:loehndorf,项目名称:scengen,代码行数:19,代码来源:Newsvendor.java

示例2: createInterval

import org.apache.commons.math3.distribution.NormalDistribution; //导入方法依赖的package包/类
/** {@inheritDoc} */
public ConfidenceInterval createInterval(int numberOfTrials, int numberOfSuccesses, double confidenceLevel) {
    IntervalUtils.checkParameters(numberOfTrials, numberOfSuccesses, confidenceLevel);
    final double alpha = (1.0 - confidenceLevel) / 2;
    final NormalDistribution normalDistribution = new NormalDistribution();
    final double z = normalDistribution.inverseCumulativeProbability(1 - alpha);
    final double zSquared = FastMath.pow(z, 2);
    final double mean = (double) numberOfSuccesses / (double) numberOfTrials;

    final double factor = 1.0 / (1 + (1.0 / numberOfTrials) * zSquared);
    final double modifiedSuccessRatio = mean + (1.0 / (2 * numberOfTrials)) * zSquared;
    final double difference = z *
                              FastMath.sqrt(1.0 / numberOfTrials * mean * (1 - mean) +
                                            (1.0 / (4 * FastMath.pow(numberOfTrials, 2)) * zSquared));

    final double lowerBound = factor * (modifiedSuccessRatio - difference);
    final double upperBound = factor * (modifiedSuccessRatio + difference);
    return new ConfidenceInterval(lowerBound, upperBound, confidenceLevel);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:20,代码来源:WilsonScoreInterval.java

示例3: getBreakpoints

import org.apache.commons.math3.distribution.NormalDistribution; //导入方法依赖的package包/类
@Override
public double[] getBreakpoints(int areas) {
    if (areas < 2) {
        throw new NumberIsTooSmallException(areas, 2, true);
    }

    NormalDistribution normalDistribution = new NormalDistribution();
    int len = areas - 1;
    double[] result = new double[len];
    double searchArea = 1.0 / areas;
    for (int i = 0; i < len; i++) {
        result[i] = normalDistribution.inverseCumulativeProbability(searchArea * (i + 1));
    }

    return result;
}
 
开发者ID:octavian-h,项目名称:time-series-math,代码行数:17,代码来源:NormalDistributionDivider.java

示例4: wilsonApache

import org.apache.commons.math3.distribution.NormalDistribution; //导入方法依赖的package包/类
public static double wilsonApache(int positive, int negative, double confidenceLevel) {
    int numberOfTrials = positive + negative;
    double alpha = (1.0 - confidenceLevel) / 2;
    NormalDistribution normalDistribution = new NormalDistribution();
    double z = normalDistribution.inverseCumulativeProbability(1 - alpha);
    double zSquared = FastMath.pow(z, 2);
    double mean = (double) positive / (double) numberOfTrials;
    double factor = 1.0 / (1 + (1.0 / numberOfTrials) * zSquared);
    double modifiedSuccessRatio = mean + (1.0 / (2 * numberOfTrials)) * zSquared;
    final double difference = z * FastMath.sqrt(1.0 / numberOfTrials * mean * (1 - mean) + (1.0 / (4 * FastMath.pow(numberOfTrials, 2)) * zSquared));
    double lowerBound = factor * (modifiedSuccessRatio - difference);
    double upperBound = factor * (modifiedSuccessRatio + difference);
    System.out.println("lower: "+lowerBound+" upper: "+upperBound+" value: "+(lowerBound+upperBound)/2);
    return (lowerBound+upperBound)/2;

}
 
开发者ID:kevoree,项目名称:kevoree-brain,代码行数:17,代码来源:MathUtil.java

示例5: solveNormalNewsvendor

import org.apache.commons.math3.distribution.NormalDistribution; //导入方法依赖的package包/类
public static Newsvendor solveNormalNewsvendor (final double price, final double cost, final double mu, final double sigma) {
	final NormalDistribution dist = new NormalDistribution();
	return new Newsvendor(price,cost) {{
		_safetyfactor = dist.inverseCumulativeProbability((price-cost)/price);
		_quantity = mu+sigma*_safetyfactor;
		_profit = (price-cost)*mu - price*sigma*dist.density(_safetyfactor);
	}
	@Override
	public double getProfit(double quantity) {
		double z = (quantity-mu)/sigma;
		double lostSales = sigma*(dist.density(z)-z*(1-dist.cumulativeProbability(z)));
		return _price*mu -_cost*quantity - _price*lostSales;
	}
	};
}
 
开发者ID:loehndorf,项目名称:scengen,代码行数:16,代码来源:Newsvendor.java

示例6: createInterval

import org.apache.commons.math3.distribution.NormalDistribution; //导入方法依赖的package包/类
/** {@inheritDoc} */
public ConfidenceInterval createInterval(int numberOfTrials, int numberOfSuccesses, double confidenceLevel) {
    IntervalUtils.checkParameters(numberOfTrials, numberOfSuccesses, confidenceLevel);
    final double alpha = (1.0 - confidenceLevel) / 2;
    final NormalDistribution normalDistribution = new NormalDistribution();
    final double z = normalDistribution.inverseCumulativeProbability(1 - alpha);
    final double zSquared = FastMath.pow(z, 2);
    final double modifiedNumberOfTrials = numberOfTrials + zSquared;
    final double modifiedSuccessesRatio = (1.0 / modifiedNumberOfTrials) * (numberOfSuccesses + 0.5 * zSquared);
    final double difference = z *
                              FastMath.sqrt(1.0 / modifiedNumberOfTrials * modifiedSuccessesRatio *
                                            (1 - modifiedSuccessesRatio));
    return new ConfidenceInterval(modifiedSuccessesRatio - difference, modifiedSuccessesRatio + difference,
                                  confidenceLevel);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:16,代码来源:AgrestiCoullInterval.java

示例7: createInterval

import org.apache.commons.math3.distribution.NormalDistribution; //导入方法依赖的package包/类
/** {@inheritDoc} */
public ConfidenceInterval createInterval(int numberOfTrials, int numberOfSuccesses,
                                         double confidenceLevel) {
    IntervalUtils.checkParameters(numberOfTrials, numberOfSuccesses, confidenceLevel);
    final double mean = (double) numberOfSuccesses / (double) numberOfTrials;
    final double alpha = (1.0 - confidenceLevel) / 2;
    final NormalDistribution normalDistribution = new NormalDistribution();
    final double difference = normalDistribution.inverseCumulativeProbability(1 - alpha) *
                              FastMath.sqrt(1.0 / numberOfTrials * mean * (1 - mean));
    return new ConfidenceInterval(mean - difference, mean + difference, confidenceLevel);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:12,代码来源:NormalApproximationInterval.java

示例8: getEstimate

import org.apache.commons.math3.distribution.NormalDistribution; //导入方法依赖的package包/类
public double getEstimate(double timestamp, double alpha) {
	if (alpha == 0.5 && measurements.size() > 0) {
		return logarithmize ? Math.pow(Math.E, measurements.getLast().runtime) : Math.max(measurements.getLast().runtime, Double.MIN_NORMAL);
	}
	
	if (differences.size() < 2) {
		return 0d;
	}

	Runtime lastMeasurement = measurements.getLast();

	double variance = 0d;
	double avgDifference = sumOfDifferences / differences.size();
	for (double difference : differences) {
		variance += Math.pow(difference - avgDifference, 2d);
	}
	variance /= differences.size() - 1;

	variance *= timestamp - lastMeasurement.timestamp;

	double estimate = lastMeasurement.runtime;
	if (variance > 0d) {
		NormalDistribution nd = new NormalDistribution(lastMeasurement.runtime, Math.sqrt(variance));
		estimate = nd.inverseCumulativeProbability(alpha);
	}

	estimate = logarithmize ? Math.pow(Math.E, estimate) : Math.max(estimate, 0d);

	return estimate;
}
 
开发者ID:marcbux,项目名称:Hi-WAY,代码行数:31,代码来源:WienerProcessModel.java


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