Add examples to elucidate the formulas (GH-14898) (GH-14899) · python/cpython@0104841

Original file line numberDiff line numberDiff line change

@@ -527,14 +527,18 @@ However, for reading convenience, most of the examples show sorted sequences.

527527

The default *method* is "exclusive" and is used for data sampled from

528528

a population that can have more extreme values than found in the

529529

samples. The portion of the population falling below the *i-th* of

530-

*m* data points is computed as ``i / (m + 1)``.

530+

*m* sorted data points is computed as ``i / (m + 1)``. Given nine

531+

sample values, the method sorts them and assigns the following

532+

percentiles: 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%.

531533
532534

Setting the *method* to "inclusive" is used for describing population

533-

data or for samples that include the extreme points. The minimum

534-

value in *dist* is treated as the 0th percentile and the maximum

535-

value is treated as the 100th percentile. The portion of the

536-

population falling below the *i-th* of *m* data points is computed as

537-

``(i - 1) / (m - 1)``.

535+

data or for samples that are known to include the most extreme values

536+

from the population. The minimum value in *dist* is treated as the 0th

537+

percentile and the maximum value is treated as the 100th percentile.

538+

The portion of the population falling below the *i-th* of *m* sorted

539+

data points is computed as ``(i - 1) / (m - 1)``. Given 11 sample

540+

values, the method sorts them and assigns the following percentiles:

541+

0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%.

538542
539543

If *dist* is an instance of a class that defines an

540544

:meth:`~inv_cdf` method, setting *method* has no effect.