Skip to content

Commit 970548c

Browse files
bpo-37905: Improve docs for NormalDist (GH-15486) (GH-15487)
(cherry picked from commit 8371799) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
1 parent e266d06 commit 970548c

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

Doc/library/statistics.rst

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -667,12 +667,8 @@ of applications in statistics.
667667

668668
.. method:: NormalDist.overlap(other)
669669

670-
Compute the `overlapping coefficient (OVL)
671-
<http://www.iceaaonline.com/ready/wp-content/uploads/2014/06/MM-9-Presentation-Meet-the-Overlapping-Coefficient-A-Measure-for-Elevator-Speeches.pdf>`_
672-
between two normal distributions, giving a measure of agreement.
673-
Returns a value between 0.0 and 1.0 giving `the overlapping area for
674-
the two probability density functions
675-
<https://www.rasch.org/rmt/rmt101r.htm>`_.
670+
Returns a value between 0.0 and 1.0 giving the overlapping area for
671+
the two probability density functions.
676672

677673
Instances of :class:`NormalDist` support addition, subtraction,
678674
multiplication and division by a constant. These operations
@@ -734,16 +730,6 @@ Find the `quartiles <https://en.wikipedia.org/wiki/Quartile>`_ and `deciles
734730
>>> [round(sat.inv_cdf(p / 10)) for p in range(1, 10)]
735731
[810, 896, 958, 1011, 1060, 1109, 1162, 1224, 1310]
736732

737-
What percentage of men and women will have the same height in `two normally
738-
distributed populations with known means and standard deviations
739-
<http://www.usablestats.com/lessons/normal>`_?
740-
741-
>>> men = NormalDist(70, 4)
742-
>>> women = NormalDist(65, 3.5)
743-
>>> ovl = men.overlap(women)
744-
>>> round(ovl * 100.0, 1)
745-
50.3
746-
747733
To estimate the distribution for a model than isn't easy to solve
748734
analytically, :class:`NormalDist` can generate input samples for a `Monte
749735
Carlo simulation <https://en.wikipedia.org/wiki/Monte_Carlo_method>`_:
@@ -754,11 +740,12 @@ Carlo simulation <https://en.wikipedia.org/wiki/Monte_Carlo_method>`_:
754740
... return (3*x + 7*x*y - 5*y) / (11 * z)
755741
...
756742
>>> n = 100_000
757-
>>> X = NormalDist(10, 2.5).samples(n)
758-
>>> Y = NormalDist(15, 1.75).samples(n)
759-
>>> Z = NormalDist(5, 1.25).samples(n)
743+
>>> seed = 86753099035768
744+
>>> X = NormalDist(10, 2.5).samples(n, seed=seed)
745+
>>> Y = NormalDist(15, 1.75).samples(n, seed=seed)
746+
>>> Z = NormalDist(50, 1.25).samples(n, seed=seed)
760747
>>> NormalDist.from_samples(map(model, X, Y, Z)) # doctest: +SKIP
761-
NormalDist(mu=19.640137307085507, sigma=47.03273142191088)
748+
NormalDist(mu=1.8661894803304777, sigma=0.65238717376862)
762749

763750
Normal distributions commonly arise in machine learning problems.
764751

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy