From 1afc5716517c901dfa35369fb7e83d22dd3bff68 Mon Sep 17 00:00:00 2001 From: carstesc Date: Sun, 6 Dec 2020 13:10:52 +0100 Subject: [PATCH 1/6] correct reference to 68-95-99.7% rule --- examples/statistics/confidence_ellipse.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/examples/statistics/confidence_ellipse.py b/examples/statistics/confidence_ellipse.py index b2978af64d49..c82f9e778384 100644 --- a/examples/statistics/confidence_ellipse.py +++ b/examples/statistics/confidence_ellipse.py @@ -34,8 +34,8 @@ # # The radiuses of the ellipse can be controlled by n_std which is the number # of standard deviations. The default value is 3 which makes the ellipse -# enclose 99.7% of the points (given the data is normally distributed -# like in these examples). +# enclose 99.4% of the points - given the data is normally distributed +# like in these examples. Why not 99.7%? See :ref:`No 68-95-99.7 Rule` below for a brief explanation. def confidence_ellipse(x, y, ax, n_std=3.0, facecolor='none', **kwargs): @@ -213,3 +213,19 @@ def get_correlated_dataset(n, dependency, mu, scale): fig.subplots_adjust(hspace=0.25) plt.show() + +############################################################################# +# +# No 68-95-99.7 Rule +# """""""""""""""""" +# +# .. no_rule: +# The well-known 68-95-99.7 rule states that in a normal distribution 68% +# of the observations lie within +/- 1 standard deviation from the mean, 95% +# within 2 standard deviations and 99.7% within 3 standard deviations. +# +# However this rule only holds for one-dimensional data. +# To adjust this rule to two-dimensional data, it suffices to square the probabilities +# of 0.68, 0.95 and 99.7 to 0.462, 0.903 and 0.994, respectively. +# If you wish, you can think of it as a new "46-90-99 Rule" for +# two-dimensional data. \ No newline at end of file From 7bbaf91abfd8988592d8be9c6c1e0a7bb2179992 Mon Sep 17 00:00:00 2001 From: carstesc Date: Sun, 6 Dec 2020 14:45:12 +0100 Subject: [PATCH 2/6] flake8 corrections --- examples/statistics/confidence_ellipse.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/statistics/confidence_ellipse.py b/examples/statistics/confidence_ellipse.py index c82f9e778384..8992f1a19ed5 100644 --- a/examples/statistics/confidence_ellipse.py +++ b/examples/statistics/confidence_ellipse.py @@ -35,7 +35,8 @@ # The radiuses of the ellipse can be controlled by n_std which is the number # of standard deviations. The default value is 3 which makes the ellipse # enclose 99.4% of the points - given the data is normally distributed -# like in these examples. Why not 99.7%? See :ref:`No 68-95-99.7 Rule` below for a brief explanation. +# like in these examples. Why not 99.7%? See :ref:`No 68-95-99.7 Rule` +# below for a brief explanation. def confidence_ellipse(x, y, ax, n_std=3.0, facecolor='none', **kwargs): @@ -218,14 +219,15 @@ def get_correlated_dataset(n, dependency, mu, scale): # # No 68-95-99.7 Rule # """""""""""""""""" -# +# # .. no_rule: # The well-known 68-95-99.7 rule states that in a normal distribution 68% # of the observations lie within +/- 1 standard deviation from the mean, 95% # within 2 standard deviations and 99.7% within 3 standard deviations. # # However this rule only holds for one-dimensional data. -# To adjust this rule to two-dimensional data, it suffices to square the probabilities +# To adjust this rule to two-dimensional data, +# it suffices to square the probabilities # of 0.68, 0.95 and 99.7 to 0.462, 0.903 and 0.994, respectively. # If you wish, you can think of it as a new "46-90-99 Rule" for -# two-dimensional data. \ No newline at end of file +# two-dimensional data. From cf05e74d6c7d48d1a5e8009317b68c5f741e75ea Mon Sep 17 00:00:00 2001 From: carstesc Date: Sun, 6 Dec 2020 20:01:13 +0100 Subject: [PATCH 3/6] add blank line after trailing documentation block. --- examples/statistics/confidence_ellipse.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/statistics/confidence_ellipse.py b/examples/statistics/confidence_ellipse.py index 8992f1a19ed5..6928f437de9a 100644 --- a/examples/statistics/confidence_ellipse.py +++ b/examples/statistics/confidence_ellipse.py @@ -231,3 +231,4 @@ def get_correlated_dataset(n, dependency, mu, scale): # of 0.68, 0.95 and 99.7 to 0.462, 0.903 and 0.994, respectively. # If you wish, you can think of it as a new "46-90-99 Rule" for # two-dimensional data. + From c5aca82980da6d6202fc89f3b702e357e6ebd64b Mon Sep 17 00:00:00 2001 From: Carsten Schelp Date: Fri, 11 Dec 2020 14:13:18 +0100 Subject: [PATCH 4/6] commit @jklymak's suggestion Co-authored-by: Jody Klymak --- examples/statistics/confidence_ellipse.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/statistics/confidence_ellipse.py b/examples/statistics/confidence_ellipse.py index 6928f437de9a..4ef59e34b989 100644 --- a/examples/statistics/confidence_ellipse.py +++ b/examples/statistics/confidence_ellipse.py @@ -34,9 +34,9 @@ # # The radiuses of the ellipse can be controlled by n_std which is the number # of standard deviations. The default value is 3 which makes the ellipse -# enclose 99.4% of the points - given the data is normally distributed -# like in these examples. Why not 99.7%? See :ref:`No 68-95-99.7 Rule` -# below for a brief explanation. +# enclose 99.4% of the points it the data is normally distributed +# like in these examples (3 standard deviations in 1-D contain 99.7% of the data, +# which is 99.4% of the data in 2-D). def confidence_ellipse(x, y, ax, n_std=3.0, facecolor='none', **kwargs): @@ -231,4 +231,3 @@ def get_correlated_dataset(n, dependency, mu, scale): # of 0.68, 0.95 and 99.7 to 0.462, 0.903 and 0.994, respectively. # If you wish, you can think of it as a new "46-90-99 Rule" for # two-dimensional data. - From 5fb61a4ee5ad208219c6e377d586d49311c28ca9 Mon Sep 17 00:00:00 2001 From: Carsten Schelp Date: Fri, 11 Dec 2020 14:42:07 +0100 Subject: [PATCH 5/6] integrate suggested change. --- examples/statistics/confidence_ellipse.py | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/examples/statistics/confidence_ellipse.py b/examples/statistics/confidence_ellipse.py index 4ef59e34b989..6bf85862d2c1 100644 --- a/examples/statistics/confidence_ellipse.py +++ b/examples/statistics/confidence_ellipse.py @@ -34,8 +34,8 @@ # # The radiuses of the ellipse can be controlled by n_std which is the number # of standard deviations. The default value is 3 which makes the ellipse -# enclose 99.4% of the points it the data is normally distributed -# like in these examples (3 standard deviations in 1-D contain 99.7% of the data, +# enclose 99.4% of the points if the data is normally distributed +# like in these examples (3 standard deviations in 1-D contain 99.7% of the data, # which is 99.4% of the data in 2-D). @@ -214,20 +214,3 @@ def get_correlated_dataset(n, dependency, mu, scale): fig.subplots_adjust(hspace=0.25) plt.show() - -############################################################################# -# -# No 68-95-99.7 Rule -# """""""""""""""""" -# -# .. no_rule: -# The well-known 68-95-99.7 rule states that in a normal distribution 68% -# of the observations lie within +/- 1 standard deviation from the mean, 95% -# within 2 standard deviations and 99.7% within 3 standard deviations. -# -# However this rule only holds for one-dimensional data. -# To adjust this rule to two-dimensional data, -# it suffices to square the probabilities -# of 0.68, 0.95 and 99.7 to 0.462, 0.903 and 0.994, respectively. -# If you wish, you can think of it as a new "46-90-99 Rule" for -# two-dimensional data. From c9dfbed94d9f7b17820f2df56f3706b05a047b3d Mon Sep 17 00:00:00 2001 From: Carsten Schelp Date: Fri, 11 Dec 2020 14:44:50 +0100 Subject: [PATCH 6/6] fix line-too-long --- examples/statistics/confidence_ellipse.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/statistics/confidence_ellipse.py b/examples/statistics/confidence_ellipse.py index 6bf85862d2c1..e663f184dcf1 100644 --- a/examples/statistics/confidence_ellipse.py +++ b/examples/statistics/confidence_ellipse.py @@ -35,8 +35,8 @@ # The radiuses of the ellipse can be controlled by n_std which is the number # of standard deviations. The default value is 3 which makes the ellipse # enclose 99.4% of the points if the data is normally distributed -# like in these examples (3 standard deviations in 1-D contain 99.7% of the data, -# which is 99.4% of the data in 2-D). +# like in these examples (3 standard deviations in 1-D contain 99.7% +# of the data, which is 99.4% of the data in 2-D). def confidence_ellipse(x, y, ax, n_std=3.0, facecolor='none', **kwargs):