@@ -514,15 +514,14 @@ However, for reading convenience, most of the examples show sorted sequences.
514
514
515
515
Set *n * to 4 for quartiles (the default). Set *n * to 10 for deciles. Set
516
516
*n * to 100 for percentiles which gives the 99 cuts points that separate
517
- *data * in to 100 equal sized groups. Raises :exc: `StatisticsError ` if *n *
517
+ *data * into 100 equal sized groups. Raises :exc: `StatisticsError ` if *n *
518
518
is not least 1.
519
519
520
- The *data * can be any iterable containing sample data or it can be an
521
- instance of a class that defines an :meth: `~inv_cdf ` method. For meaningful
520
+ The *data * can be any iterable containing sample data. For meaningful
522
521
results, the number of data points in *data * should be larger than *n *.
523
522
Raises :exc: `StatisticsError ` if there are not at least two data points.
524
523
525
- For sample data, the cut points are linearly interpolated from the
524
+ The cut points are linearly interpolated from the
526
525
two nearest data points. For example, if a cut point falls one-third
527
526
of the distance between two sample values, ``100 `` and ``112 ``, the
528
527
cut-point will evaluate to ``104 ``.
@@ -547,9 +546,6 @@ However, for reading convenience, most of the examples show sorted sequences.
547
546
values, the method sorts them and assigns the following percentiles:
548
547
0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%.
549
548
550
- If *data * is an instance of a class that defines an
551
- :meth: `~inv_cdf ` method, setting *method * has no effect.
552
-
553
549
.. doctest ::
554
550
555
551
# Decile cut points for empirically sampled data
@@ -561,11 +557,6 @@ However, for reading convenience, most of the examples show sorted sequences.
561
557
>>> [round (q, 1 ) for q in quantiles(data, n = 10 )]
562
558
[81.0, 86.2, 89.0, 99.4, 102.5, 103.6, 106.0, 109.8, 111.0]
563
559
564
- >>> # Quartile cut points for the standard normal distribution
565
- >>> Z = NormalDist()
566
- >>> [round (q, 4 ) for q in quantiles(Z, n = 4 )]
567
- [-0.6745, 0.0, 0.6745]
568
-
569
560
.. versionadded :: 3.8
570
561
571
562
@@ -607,6 +598,18 @@ of applications in statistics.
607
598
<https://en.wikipedia.org/wiki/Arithmetic_mean> `_ of a normal
608
599
distribution.
609
600
601
+ .. attribute :: median
602
+
603
+ A read-only property for the `median
604
+ <https://en.wikipedia.org/wiki/Median> `_ of a normal
605
+ distribution.
606
+
607
+ .. attribute :: mode
608
+
609
+ A read-only property for the `mode
610
+ <https://en.wikipedia.org/wiki/Mode_(statistics)> `_ of a normal
611
+ distribution.
612
+
610
613
.. attribute :: stdev
611
614
612
615
A read-only property for the `standard deviation
@@ -678,6 +681,16 @@ of applications in statistics.
678
681
the two probability density functions
679
682
<https://www.rasch.org/rmt/rmt101r.htm> `_.
680
683
684
+ .. method :: NormalDist.quantiles()
685
+
686
+ Divide the normal distribution into *n * continuous intervals with
687
+ equal probability. Returns a list of (n - 1) cut points separating
688
+ the intervals.
689
+
690
+ Set *n * to 4 for quartiles (the default). Set *n * to 10 for deciles.
691
+ Set *n * to 100 for percentiles which gives the 99 cuts points that
692
+ separate the normal distribution into 100 equal sized groups.
693
+
681
694
Instances of :class: `NormalDist ` support addition, subtraction,
682
695
multiplication and division by a constant. These operations
683
696
are used for translation and scaling. For example:
@@ -733,9 +746,9 @@ Find the `quartiles <https://en.wikipedia.org/wiki/Quartile>`_ and `deciles
733
746
734
747
.. doctest ::
735
748
736
- >>> list (map (round , quantiles(sat )))
749
+ >>> list (map (round , sat. quantiles()))
737
750
[928, 1060, 1192]
738
- >>> list (map (round , quantiles(sat, n = 10 )))
751
+ >>> list (map (round , sat. quantiles(n = 10 )))
739
752
[810, 896, 958, 1011, 1060, 1109, 1162, 1224, 1310]
740
753
741
754
To estimate the distribution for a model than isn't easy to solve
0 commit comments