This project has moved. For the latest updates, please go here.

Problem with obtaining Percentile from Sample using LeftProbability

Jun 8, 2012 at 12:35 PM


Have just started using the library and want to firstly say thank you for building the API and offering it free as it has a lot of good functionality which is of great benefit to me.

I am having a problem with trying to obtain a percentile(quantile) from a sample. For some reason after populating a Sample with some values and then calling the LeftProbability function all it returns is zero or 1 depending on the argument passed. I was expecting to get back a decimal value representing the percentile corresponding to the value passed. It may be that I have misunderstood the usage of these functions so please correct me if I am wrong. See my code below

Dim sample1 As New Sample

sample1.Add(New Double() {11.0, 12, 13, 34, 55, 18, 12, 11, 24, 22, 21, 33})       

sample1.InverseLeftProbability(0.9) <<<< this call returns 33.9 which is correct

sample1.LeftProbability(33.9) <<<< this call returns 0, should be .9 or 90th percentile

Jul 10, 2012 at 9:03 AM

Yep, it's a bug. See for rogermosher's bug report, in which he correctly diagnoses the problem in the code. It will be fixed in the next release.