Search code examples
c#.netnormal-distribution

Using .Net's StatisticFormula Library


The C# namespace System.Windows.Forms.DataVisualization.Charting.StatisticFormula seems to have a few statistical functions that I need. The namespace is documented at MSDN here. I'd really like to use the InverseNormalDistribution(double Z) function. The problem is that the constructor is internal and so I can't access the functions in anyway that I know.

Is there some way to have access to the statics functions in this namespace, or will I have to find other solution?


Solution

  • You could probably use reflection, something like this should do it:

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

    But this may be a better way:

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