本文整理汇总了C#中MathNet.Numerics.Distributions.Normal.InverseCumulativeDistribution方法的典型用法代码示例。如果您正苦于以下问题:C# Normal.InverseCumulativeDistribution方法的具体用法?C# Normal.InverseCumulativeDistribution怎么用?C# Normal.InverseCumulativeDistribution使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MathNet.Numerics.Distributions.Normal
的用法示例。
在下文中一共展示了Normal.InverseCumulativeDistribution方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InflationFactor
/// <summary>
/// Truncated N(0, 1) to (x1, x2), where P(X <= x1) = trim and P(X <= x2) = 1 - trim
/// </summary>
/// <param name="trim">tail probability</param>
/// <returns>approximately (E[X^2] = 1) / Et[X^2]</returns>
private static double InflationFactor(double trim)
{
var norm = new Normal(); // N(0, 1)
double a = norm.InverseCumulativeDistribution(1 - trim);
double step = 2 * a / 10000;
double[] x1s = Helper.Seq(-a + step / 2, a - step / 2, 10000);
// Truncated N(0, 1) to P(X <= x) = trim and P(X <= x) = 1 - trim
double eX2 = 0.0;
foreach (double x1 in x1s) { eX2 += (x1 * x1) * norm.Density(x1); }
eX2 = eX2 * step / (1 - 2 * trim);
// eX2 now approximates Et[X^2]: E[X^2] of the truncated N(0, 1)
return 1 / eX2; // approx (E[X^2] = 1) / Et[X^2]
// == 1 / (1 + (-a * dnorm(-a) - a * dnorm(a)) / (1 - 2*trim) - ((dnorm(-1) - dnorm(a)) / (1 - 2* trim))^2)
// According to http://en.wikipedia.org/wiki/Truncated_normal_distribution
}