.net.net-coremath.net

Stats with Math.Net


How do you calculate the 99.5 percentile using Math.NET?

98 percentile is

MathNet.Numerics.Statistics.Statistics.Percentile(valuesInDecile, 100 - 2)

99 percentile is

MathNet.Numerics.Statistics.Statistics.Percentile(valuesInDecile, 100 - 1)

For a non integer p-value it says using quartile function. How should this be used as it returns NaN for

MathNet.Numerics.Statistics.Statistics.Quantile(valuesInDecile, 100 - 0.5f)

My data set on which I am trying to run this:

0.0353737
0.0009659
0.0005655
0.0053452
0.0402773
0.0018171
0.0193516
0.0003455
0.0505242
0.0539421
0.0363619
0.0293928
0.0356062
0.0352433
0.0577016
0.0529182
0.0015018
0.0436227
0.0042247
0.0157081
0.0112555
0.0061088
0.0319852
0.020557
0.0106685
0.029806
0.0053733
0.0965764
0.0001344
0.0033052
0.0080388
0.0189088
0.024258
0.0254075
0.0852993
0.0055825
0.0712195
0.0682945
0.013282

Solution

  • Try:

    MathNet.Numerics.Statistics.Statistics.Quantile(valuesInDecile, 1d - 0.005d)
    

    Instead of grouping into 4 or 100 boxes, quantiles generalize the concept to an infinite number of boxes and thus to arbitrary real numbers tau between 0.0 and 1.0, where 0.0 represents the minimum value, 0.5 the median and 1.0 the maximum value.
    Quantiles | Descriptive Statistics