Quantcast
Channel: Math.NET Numerics
Viewing all articles
Browse latest Browse all 971

New Post: Percentile obsolete, how to use quantile?

$
0
0
Hi,

2) The result is wrong because the array was not sorted (which is expected by SortedArrayStatistics, other than ArrayStatistics). Once sorted, the result should be close, although not exactly the same because by default the new Quantile uses the R8 quantile definition while Percentile by default uses R6/Nist definition.
Array.Sort(rmmSamples); // use .ToArray on the first line in your sample to get consistent data to compare
SortedArrayStatistics.Quantile(rmmSamples, .25) // R8-quantile
SortedArrayStatistics.QuantileCustom(rmmSamples, .25, QuantileDefinition.Nist) // R6/Nist-quantile
1) Instead of sorting yourself, you can also use Statistics.QuantileFunc (or Statistics.QuantileCustomFunc if you want a quantile definition other than R8) directly and get something closer to the original code:
var quantile = Statistics.QuantileFunc(rmmSamples); // can be an unsorted IEnumerable
quantile(0.25) // evaluate for a single tau
new[] {0.0, .25, .5, .75,1.0 }.Select(quantile) // evaluate for a tau sequence
Thanks,
Christoph

Viewing all articles
Browse latest Browse all 971

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>