|
Boost-Commit : |
From: john_at_[hidden]
Date: 2007-08-25 14:05:41
Author: johnmaddock
Date: 2007-08-25 14:05:41 EDT (Sat, 25 Aug 2007)
New Revision: 38947
URL: http://svn.boost.org/trac/boost/changeset/38947
Log:
Fixed some typos, changes 1 title, and fixed markup in normal_misc_examples.cpp.
Text files modified:
sandbox/math_toolkit/libs/math/doc/distributions/negative_binomial_example.qbk | 2 +-
sandbox/math_toolkit/libs/math/example/binomial_coinflip_example.cpp | 2 +-
sandbox/math_toolkit/libs/math/example/binomial_example3.cpp | 4 ++--
sandbox/math_toolkit/libs/math/example/binomial_example_NAG_C.cpp | 2 +-
sandbox/math_toolkit/libs/math/example/normal_misc_examples.cpp | 25 +++++++++++++++----------
5 files changed, 20 insertions(+), 15 deletions(-)
Modified: sandbox/math_toolkit/libs/math/doc/distributions/negative_binomial_example.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/distributions/negative_binomial_example.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/distributions/negative_binomial_example.qbk 2007-08-25 14:05:41 EDT (Sat, 25 Aug 2007)
@@ -230,7 +230,7 @@
[endsect] [/section:negative_binomial_example1]
-[section:negative_binomial_example2 Negative Binomial example 2.]
+[section:negative_binomial_example2 Negative Binomial Table Printing Example.]
Example program showing output of a table of values of cdf and pdf for various k failures.
[import ../../example/negative_binomial_example2.cpp]
[neg_binomial_example2]
Modified: sandbox/math_toolkit/libs/math/example/binomial_coinflip_example.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/example/binomial_coinflip_example.cpp (original)
+++ sandbox/math_toolkit/libs/math/example/binomial_coinflip_example.cpp 2007-08-25 14:05:41 EDT (Sat, 25 Aug 2007)
@@ -91,7 +91,7 @@
cout << "Probability of getting no heads is " << pdf(flip, 0) << endl;
cout << "Probability of getting at least one head is " << 1. - pdf(flip, 0) << endl;
/*`
-When we want to calculate the probabilty for a range or values we can sum the PDF's:
+When we want to calculate the probability for a range or values we can sum the PDF's:
*/
cout << "Probability of getting 0 or 1 heads is "
<< pdf(flip, 0) + pdf(flip, 1) << endl; // sum of exactly == probabilities
Modified: sandbox/math_toolkit/libs/math/example/binomial_example3.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/example/binomial_example3.cpp (original)
+++ sandbox/math_toolkit/libs/math/example/binomial_example3.cpp 2007-08-25 14:05:41 EDT (Sat, 25 Aug 2007)
@@ -5,7 +5,7 @@
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
-// Simple example of computing probabilitiesfor a binomial random variable.
+// Simple example of computing probabilities for a binomial random variable.
// Replication of source nag_binomial_dist (g01bjc).
// Shows how to replace NAG C library calls by Boost Math Toolkit C++ calls.
@@ -32,7 +32,7 @@
using boost::math::binomial_distribution;
// This replicates the computation of the examples of using nag-binomial_dist
- // using g01bjc in section g01 Somple Calculations on Statistical Data.
+ // using g01bjc in section g01 Sample Calculations on Statistical Data.
// http://www.nag.co.uk/numeric/cl/manual/pdf/G01/g01bjc.pdf
// Program results section 8.3 page 3.g01bjc.3
//8.2. Program Data
Modified: sandbox/math_toolkit/libs/math/example/binomial_example_NAG_C.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/example/binomial_example_NAG_C.cpp (original)
+++ sandbox/math_toolkit/libs/math/example/binomial_example_NAG_C.cpp 2007-08-25 14:05:41 EDT (Sat, 25 Aug 2007)
@@ -5,7 +5,7 @@
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
-// Simple example of computing probabilitiesfor a binomial random variable.
+// Simple example of computing probabilities for a binomial random variable.
// Replication of source nag_binomial_dist (g01bjc).
// Shows how to replace NAG C library calls by Boost Math Toolkit C++ calls.
Modified: sandbox/math_toolkit/libs/math/example/normal_misc_examples.cpp
==============================================================================
--- sandbox/math_toolkit/libs/math/example/normal_misc_examples.cpp (original)
+++ sandbox/math_toolkit/libs/math/example/normal_misc_examples.cpp 2007-08-25 14:05:41 EDT (Sat, 25 Aug 2007)
@@ -57,13 +57,13 @@
<< setprecision(precision) << setw(12) << pdf(s, z) << endl;
}
cout.precision(6); // default
- /*`And the area under the normal curve from -[infin] upto z,
+ /*`And the area under the normal curve from -[infin] up to z,
the cumulative distribution function (cdf).
*/
// For a standard normal distribution
cout << "Standard normal mean = "<< s.mean()
<< ", standard deviation = " << s.standard_deviation() << endl;
- cout << "Integral (area under the curve) from - infinity upto z " << endl;
+ cout << "Integral (area under the curve) from - infinity up to z " << endl;
cout << " z " " cdf " << endl;
for (double z = -range; z < range + step; z += step)
{
@@ -129,16 +129,16 @@
/*`Notice the distinction between one-sided (also called one-tailed)
where we are using a > *or* < test (and not both)
-and considering the area of the tail (integral) from z upto +[infin],
+and considering the area of the tail (integral) from z up to +[infin],
and a two-sided test where we are using two > *and* < tests, and thus considering two tails,
-from -[infin] upto z low and z high upto +[infin].
+from -[infin] up to z low and z high up to +[infin].
So the 2-sided values alpha[i] are calculated using alpha[i]/2.
If we consider a simple example of alpha = 0.05, then for a two-sided test,
-the lower tail area from -[infin] upto -1.96 is 0.025 (alpha/2)
-and the upper tail area from +z upto +1.96 is also 0.025 (alpha/2),
-and the area between -1.96 upto 12.96 is alpha = 0.95.
+the lower tail area from -[infin] up to -1.96 is 0.025 (alpha/2)
+and the upper tail area from +z up to +1.96 is also 0.025 (alpha/2),
+and the area between -1.96 up to 12.96 is alpha = 0.95.
and the sum of the two tails is 0.025 + 0.025 = 0.05,
*/
@@ -165,19 +165,23 @@
/*`
To a useful precision, the 1, 2 & 3 percentages are 68, 95 and 99.7,
and these are worth memorising as useful 'rules of thumb', as, for example, in
-[@http://en.wikipedia.org/wiki/Standard_deviation standard deviation]
+[@http://en.wikipedia.org/wiki/Standard_deviation standard deviation]:
+[pre
Fraction 1 standard deviation within either side of mean is 0.683
Fraction 2 standard deviations within either side of mean is 0.954
Fraction 3 standard deviations within either side of mean is 0.997
+]
We could of course get some really accurate values for these
[@http://en.wikipedia.org/wiki/Confidence_interval confidence intervals]
by using cout.precision(15);
+[pre
Fraction 1 standard deviation within either side of mean is 0.682689492137086
Fraction 2 standard deviations within either side of mean is 0.954499736103642
Fraction 3 standard deviations within either side of mean is 0.997300203936740
+]
But before you get too excited about this impressive precision,
don't forget that the *confidence intervals of the standard deviation* are surprisingly wide,
@@ -220,7 +224,8 @@
/*`
[note Real-life failures are often very ab-normal,
with a significant number that 'dead-on-arrival' or suffer failure very early in their life:
-the lifetime of the suvivors of 'early mortality' may be well described by the normal distribution.]
+the lifetime of the survivors of 'early mortality' may be well described by the normal distribution.]
+*/
//] [/normal_bulbs_example1 Quickbook end]
}
{
@@ -445,7 +450,7 @@
3 0.0044318484119380075
4 0.00013383022576488537
Standard normal mean = 0, standard deviation = 1
-Integral (area under the curve) from - infinity upto z
+Integral (area under the curve) from - infinity up to z
z cdf
-4 3.1671241833119979e-005
-3 0.0013498980316300959
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk