简体   繁体   English

反正态累积分布函数转换

[英]Inverse normal cumulative distribution function conversion

we used the Extreme Numerics library from Extreme Optimization ( http://www.extremeoptimization.com ) for our calculation kernel. 我们将Extreme Optimization( http://www.extremeoptimization.com )中的Extreme Numerics库用于我们的计算内核。

// portfolio risk is inverse normal cumulative distribution function
double risk = NormalDistribution.InverseDistributionFunction(
  _riskProbabilityLevel, 
  mean, 
  stdev);

The problem is now we are moving from C# to Java and I don't really know all that much about Java but have been tasked with re-writing this particular function. 现在的问题是,我们正在从C#迁移到Java,我对Java的了解并不多,但是却要负责重写此特定函数。

I have values to test against: 我有值得测试的价值观:

RiskProbabilityLevel = 0.02
Mean                 = 0.06618
Standard Dev         = 0.057196166520267355

Risk                 = 0.051286461995869864

but in looking thru the various functions in math3.distribution.NormalDistribution libraries I can't find what might be equivalent. 但是在math3.distribution.NormalDistribution库中的各种函数时,我找不到等效的东西。

Any direction or help would be appreciated. 任何方向或帮助将不胜感激。 thanks. 谢谢。

I think you can use this library. 我认为您可以使用库。 It's called apache commons.math3 . 它称为apache commons.math3 It's very popular. 非常受欢迎 From the docs supplied by http://www.extremeoptimization.com I think you can use the following code: http://www.extremeoptimization.com提供的文档中,我认为您可以使用以下代码:

import org.apache.commons.math3.distribution.NormalDistribution;

public class TestProbabilites {

    public static void main(String[] args) {
        double riskProbabilityLevel = 0.02D;
        double mean = 0.06618D;
        double standardDev = 0.057196166520267355D;
        double expectedRisk = 0.051286461995869864D;

        NormalDistribution distribution = new NormalDistribution(mean, standardDev);
        double outcomeRisk = distribution.inverseCumulativeProbability(riskProbabilityLevel);
    }
}

But you have to remember to add the apache.commons.math3 library added to your project using Maven or Gradle or some other dependencies manager. 但是您必须记住要使用MavenGradle或其他依赖管理器将apache.commons.math3库添加到您的项目中。

Hopes this helps. 希望这会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM