使用.Net的StatisticFormula库

时间:2012-07-12 19:19:15

标签: c# .net normal-distribution

C#命名空间System.Windows.Forms.DataVisualization.Charting.StatisticFormula似乎有一些我需要的统计函数。命名空间记录在MSDN here。我真的很想使用InverseNormalDistribution(double Z)函数。问题是构造函数是内部的,所以无论如何我都无法访问函数。

有没有办法访问此命名空间中的静态函数,还是我必须找到其他解决方案?

1 个答案:

答案 0 :(得分:3)

你可能会使用反射,像这样的事情应该这样做:

var statisticFormula = 
    (StatisticFormula) typeof(StatisticFormula).GetConstructor(
        BindingFlags.NonPublic | BindingFlags.Instance,
        null, Type.EmptyTypes, null).Invoke(null);

但这可能是更好的方法:

var chart = new Chart();
var value = chart.DataManipulator.Statistics.InverseNormalDistribution(.15)