
BoostCommit : 
Subject: [Boostcommit] svn:boost r50743  sandbox/math_toolkit/libs/math/doc/sf_and_dist/distributions
From: pbristow_at_[hidden]
Date: 20090123 06:21:03
Author: pbristow
Date: 20090123 06:21:03 EST (Fri, 23 Jan 2009)
New Revision: 50743
URL: http://svn.boost.org/trac/boost/changeset/50743
Log:
Tiny typos.
Text files modified:
sandbox/math_toolkit/libs/math/doc/sf_and_dist/distributions/hypergeometric.qbk  72 ++++++++++++++++++++
1 files changed, 36 insertions(+), 36 deletions()
Modified: sandbox/math_toolkit/libs/math/doc/sf_and_dist/distributions/hypergeometric.qbk
==============================================================================
 sandbox/math_toolkit/libs/math/doc/sf_and_dist/distributions/hypergeometric.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/distributions/hypergeometric.qbk 20090123 06:21:03 EST (Fri, 23 Jan 2009)
@@ 2,9 +2,9 @@
``#include <boost/math/distributions/hypergeometric.hpp>``
 namespace boost{ namespace math{

 template <class RealType = double,
+ namespace boost{ namespace math{
+
+ template <class RealType = double,
class ``__Policy`` = ``__policy_class`` >
class hypergeometric_distribution;
@@ 25,22 +25,22 @@
typedef hypergeometric_distribution<> hypergeometric;
}} // namespaces

+
The hypergeometric distribution describes the number of "events" /k/
from a sample /n/ drawn from a total population /N/ ['without replacement].
Imagine we have a sample of /N/ objects of which /r/ are "defective"
and Nr are "not defective"
(the terms "success\/failure" or "red\/blue" are also used). If we sample /n/
+(the terms "success\/failure" or "red\/blue" are also used). If we sample /n/
items /without replacement/ then what is the probability that exactly
/k/ items in the sample are defective? The answer is given by the pdf of the
hypergeometric distribution `f(k; r, n, N)`, whilst the probability of
/k/ defectives or fewer is given by F(k; r, n, N), where F(k) is the
+/k/ defectives or fewer is given by F(k; r, n, N), where F(k) is the
CDF of the hypergeometric distribution.
[note Unlike almost all of the other distributions in this library,
the hypergeometric distribution is strictly discrete: it can not be
extended to real valued arguments of it's parameters or random variable.]
+extended to real valued arguments of its parameters or random variable.]
The following graph shows how the distribution changes as the proportion
of "defective" items changes, while keeping the population and sample sizes
@@ 57,20 +57,20 @@
[h4 Member Functions]
hypergeometric_distribution(unsigned r, unsigned n, unsigned N);

+
Constructs a hypergeometric distribution with with a population of /N/ objects,
of which /r/ are defective, and from which /n/ are sampled.
unsigned total()const;

+
Returns the total number of objects /N/.

+
unsigned defective()const;

+
Returns the number of objects /r/ in population /N/ which are defective.

+
unsigned sample_count()const;

+
Returns the number of objects /n/ which are sampled from the population /N/.
[h4 Nonmember Accessors]
@@ 102,22 +102,22 @@
describe how to change the rounding policy
for these distributions.
However, note that the implementation method of the quantile function
always returns an integral value, therefore attempting to use a __Policy
that requires (or produces) a real valued result will result in a
+However, note that the implementation method of the quantile function
+always returns an integral value, therefore attempting to use a __Policy
+that requires (or produces) a real valued result will result in a
compile time error.
] [/ caution]
[h4 Accuracy]
For small N such that
+For small N such that
`N < boost::math::max_factorial<RealType>::value` then table based
lookup of the results gives an accuracy to a few epsilon.
+lookup of the results gives an accuracy to a few epsilon.
`boost::math::max_factorial<RealType>::value` is 170 at double or long double
precision.
For larger N such that `N < boost::math::prime(boost::math::max_prime)`
+For larger N such that `N < boost::math::prime(boost::math::max_prime)`
then only basic arithmetic is required for the calculation
and the accuracy is typically < 20 epsilon. This takes care of N
up to 104729.
@@ 126,15 +126,15 @@
degrades, with 5 or 6 decimal digits being lost for N = 110000.
In general for very large N, the user should expect to loose log[sub 10]N
decimal digits of precision during the calculation, with the results
+decimal digits of precision during the calculation, with the results
becoming meaningless for N >= 10[super 15].
[h4 Testing]
There are three sets of tests: our implementation is tested against a table of values
produced by Mathematica's implementation of this distribution, we also sanity check
+produced by Mathematica's implementation of this distribution. We also sanity check
our implementation against some spot values computed using the online calculator
here [@http://stattrek.com/Tables/Hypergeometric.aspx http://stattrek.com/Tables/Hypergeometric.aspx].
+here [@http://stattrek.com/Tables/Hypergeometric.aspx http://stattrek.com/Tables/Hypergeometric.aspx].
Finally we test accuracy against some high precision test data using
this implementation and NTL::RR.
@@ 145,15 +145,15 @@
[equation hypergeometric1]
However, this can only be used directly when the largest of the factorials
is guaranteed not to overflow the floating point representation used.
+is guaranteed not to overflow the floating point representation used.
This formula is used directly when `N < max_factorial<RealType>::value`
in which case table lookup of the factorials gives a rapid and accurate
implementation method.
For larger /N/ the method described in
+For larger /N/ the method described in
"An Accurate Computation of the Hypergeometric Distribution Function",
Trong Wu, ACM Transactions on Mathematical Software, Vol. 19, No. 1,
March 1993, Pages 3343 is used. The method relies on the fact that
+Trong Wu, ACM Transactions on Mathematical Software, Vol. 19, No. 1,
+March 1993, Pages 3343 is used. The method relies on the fact that
there is an easy method for factorising a factorial into the product
of prime numbers:
@@ 175,14 +175,14 @@
or no more than 1 or 2.
Calculation of the product of the primes requires some care to prevent
numerical overflow, we use a novel recursive method which splits the
calculation into a series of subproducts, with a new subproduct
started each time the next multiplication would cause either overflow
or underflow. The subproducts are stored in a linked list on the
program stack, and combined in an order that will guarantee no overflow
+numerical overflow, we use a novel recursive method which splits the
+calculation into a series of subproducts, with a new subproduct
+started each time the next multiplication would cause either overflow
+or underflow. The subproducts are stored in a linked list on the
+program stack, and combined in an order that will guarantee no overflow
or unnecessaryunderflow once the last subproduct has been calculated.
This method can be used as long as N is smaller than the largest prime
+This method can be used as long as N is smaller than the largest prime
number we have stored in our table of primes (currently 104729). The method
is relatively slow (calculating the exponents requires the most time), but
requires only a small number of arithmetic operations to
@@ 195,11 +195,11 @@
calculating via logarithms. We use the latter method, as it is usually
1 or 2 decimal digits more accurate than computing via logarithms with
lgamma. However, in this area where N > 104729, the user should expect
to loose around log[sub 10]N decimal digits during the calculation in
+to loose around log[sub 10]N decimal digits during the calculation in
the worst case.
The CDF and it's complement is calculated by directly summing the PDF's.
We start by deciding whether the CDF or it's complement is likely to be
+The CDF and its complement is calculated by directly summing the PDF's.
+We start by deciding whether the CDF, or its complement, is likely to be
the smaller of the two and then calculate the PDF at /k/ (or /k+1/ if we're
calculating the complement) and calculate successive PDF values via the
recurrence relations:
@@ 210,7 +210,7 @@
PDF value to be summed would be too small to affect the result.
The quantile is calculated in a similar manner to the CDF: we first guess
which end of the distribution we're nearer to, and then sum PDF's starting
+which end of the distribution we're nearer to, and then sum PDFs starting
from the end of the distribution this time, until we have some value /k/ that
gives the required CDF.
BoostCommit 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