Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

I think adding quantiles (sometimes called fractiles) is a good feature to add. 
I especially have some use-cases for quartiles. I especially like that it 
delegates to the inv_cdf() method when available, and I'm happy with the API 
you suggested.

Forgive me if you're already aware of this, but the calculation of quantiles is 
unfortunately complicated by the fact that there are so many different ways to 
calculate them. (I see you have mentioned a potential future API for 
interp_method.)

See, for example:

http://jse.amstat.org/v14n3/langford.html

for a discussion. My own incomplete survey of statistics software has found 
about 20 distinct methods for calculating quantiles in use. I'm very happy to 
see this function added, but I'm not happy to commit to a specific calculation 
method without discussion.

If you agree that we can change the implementation later (and hence the 
specific cut points returned) then I see no reason why we can't get this in 
before feature freeze, and then do a review to find the "best" default 
implementation later. I already have three candidates:

1. Langford suggests his "CDF method 4", which is equivalent to Hyndman and 
Fan's Definition 2; it is also the default method used by SAS.

2. Hyndman and Fan themselves recommend their Definition 8:

https://robjhyndman.com/publications/quantiles/

3. R's default is H&F's Definition 7. (I suggest this only to ease comparisons 
with results from R, not because it has any statistical advantage.)

Do we agree that there is to be no backwards-compatibility guarantee made on 
the implementation and the specific cut-points returned? (Or at least not yet.)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36546>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to