[SciPy-dev] percentileofscore

josef.pktd at gmail.com josef.pktd at gmail.com
Mon Nov 17 00:53:29 EST 2008


On Sun, Nov 16, 2008 at 10:56 PM, Robert Kern <robert.kern at gmail.com> wrote:

>
> Wikipedia says to use half of the frequency of the ties (x==score) in
> addition to the cumulative frequency of strict x<score.
>
>  http://en.wikipedia.org/wiki/Percentile_rank
>

The 0.5 weight looks pretty arbitrary to me
percentilescore_wikip([1,2,3,4,4,4,5,6,7,8]) = 3 + 0.5*3 = 4.5

I guess the question is, whether this a commonly accepted convention,
or maybe, which and whose convention should scipy follow.

The proposed patch is pretty easy to adjust to any convention.
Maybe percentileofscore should get a weight parameter for ties:
0 for strict inequality, 1 for weak inequality,
0.5 (default?) for wikipedia and -1 for mean.

The inverse functions, scoreatpercentile and mquantiles in stats.mstats,
give a whole range of weighting schemes, but it takes too long now
for me to figure out what that actually does.

Josef



More information about the SciPy-Dev mailing list