Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Percentile Calculation Bug? #80

Open
pigubaoza opened this issue Sep 11, 2023 · 4 comments
Open

Percentile Calculation Bug? #80

pigubaoza opened this issue Sep 11, 2023 · 4 comments

Comments

@pigubaoza
Copy link

Given a slice a := []float64{0, 300, 600}
stats.Percentile(a, 50) should return 300. However it returns 150.

@pigubaoza
Copy link
Author

i think it's fixed here
#72

@JojoFlower
Copy link

the fix has not been released yet @montanaflynn
given a := []float64{1, 2, 3}
stats.Percentile(a, 50) should return 1.5 instead of 2 🙏

@montanaflynn
Copy link
Owner

I think this is just a case of two different percentile algorithm's. Do you have a reference to the percentile algo that produces 1.5? The output should be 2 according to numpy and wolframalpha:

import numpy as np
a = np.array([1, 2, 3])
print(np.percentile(a, 50))
// 2

https://www.wolframalpha.com/input?i=50th+percentile+of+1%2C+2%2C+3

@pigubaoza
Copy link
Author

yes i believe for {0, 300, 600}, it should be 300, and for {1, 2, 3}, it should be 2.
@JojoFlower please correct us if it's wrong.

@montanaflynn is the fix (along with all the other merged pull requests), ready to be released yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants