Opened 22 months ago
Last modified 22 months ago
#34325 closed Cleanup/optimization
PercentRank confusion — at Version 3
Reported by: | dennisvang | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 4.1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
The documentation for the PercentRank window function says:
Computes the percentile rank of the rows in the frame clause. This computation is equivalent to evaluating:
(rank - 1) / (total rows - 1)
(my emphasis)
However, I'm not so sure "percentile rank" is the correct term.
If you look up the (statistical) term "percentile rank" online, you'll find various definitions, ranging from
(CF - 0.5 * F) / N
where CF—the cumulative frequency—is the count of all scores less than or equal to the score of interest, F is the frequency for the score of interest, and N is the number of scores in the distribution.
<number of values less than the score of interest> / <total number of values in the data set>
(equivalent to (CF - F) / N
)
Similar definitions are also used e.g. by scipy.
The latter definition is similar to that in the Django docs, but still subtly different in the denominator.
Note also that the documentation for the percent_rank
function in the SQLite and PostgreSQL database backends does not mention "percentile rank" at all. Instead, they use the term "relative rank."
To prevent confusion, wouldn't it be better to use the same terminology as the database backends?
Change History (3)
comment:1 by , 22 months ago
Description: | modified (diff) |
---|
comment:2 by , 22 months ago
Description: | modified (diff) |
---|
comment:3 by , 22 months ago
Description: | modified (diff) |
---|