Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65107 - trunk/libs/math/doc/sf_and_dist/distributions
From: pbristow_at_[hidden]
Date: 2010-08-29 13:51:23


Author: pbristow
Date: 2010-08-29 13:51:21 EDT (Sun, 29 Aug 2010)
New Revision: 65107
URL: http://svn.boost.org/trac/boost/changeset/65107

Log:
inverse_gamma distribution 1st draft
Added:
   trunk/libs/math/doc/sf_and_dist/distributions/inverse_gamma.qbk (contents, props changed)

Added: trunk/libs/math/doc/sf_and_dist/distributions/inverse_gamma.qbk
==============================================================================
--- (empty file)
+++ trunk/libs/math/doc/sf_and_dist/distributions/inverse_gamma.qbk 2010-08-29 13:51:21 EDT (Sun, 29 Aug 2010)
@@ -0,0 +1,120 @@
+[section:inverse_gamma_dist Inverse Gamma Distribution]
+
+``#include <boost/math/distributions/inverse_gamma.hpp>``
+
+ namespace boost{ namespace math{
+
+ template <class RealType = double,
+ class ``__Policy`` = ``__policy_class`` >
+ class inverse_gamma_distribution
+ {
+ public:
+ typedef RealType value_type;
+ typedef Policy policy_type;
+
+ inverse_gamma_distribution(RealType shape, RealType scale = 1)
+
+ RealType shape()const;
+ RealType scale()const;
+ };
+
+ }} // namespaces
+
+The inverse_gamma distribution is a continuous probability distribution distribution
+of the reciprocal of a variable distributed according to the gamma distribution..
+
+
+[note
+In spite of potential confusion with the inverse gamma function, this
+distribution does provide the typedef:
+
+``typedef inverse_gamma_distibution<double> gamma;``
+
+If you want a double precision gamma distribution you can use
+
+``boost::math::inverse_gamma_distribution<>``]
+
+For shape parameter /k/ and scale parameter [theta][space] it is defined by the
+probability density function:
+
+[equation inverse_gamma_dist_ref1]
+
+Sometimes an alternative formulation is used: given parameters
+[alpha][space]= k and [beta][space]= 1 / [theta], then the
+distribution can be defined by the PDF:
+
+[equation inverse_gamma_dist_ref2]
+
+
+The following two graphs illustrate how the PDF of the gamma distribution
+varies as the parameters vary:
+
+[graph inverse_gamma1_pdf]
+
+[graph inverse_gamma2_pdf]
+
+
+
+[h4 Member Functions]
+
+ inverse_gamma_distribution(RealType shape, RealType scale = 1);
+
+Constructs a gamma distribution with shape /shape/ and
+scale /scale/.
+
+Requires that the shape and scale parameters are greater than zero, otherwise calls
+__domain_error.
+
+ RealType shape()const;
+
+Returns the /shape/ parameter of this distribution.
+
+ RealType scale()const;
+
+Returns the /scale/ parameter of this distribution.
+
+[h4 Non-member Accessors]
+
+All the [link math_toolkit.dist.dist_ref.nmp usual non-member accessor functions] that are generic to all
+distributions are supported: __usual_accessors.
+
+The domain of the random variable is \[0,+[infin]\].
+
+[h4 Accuracy]
+
+The inverse gamma distribution is implemented in terms of the
+incomplete gamma functions __gamma_p and __gamma_q and their
+inverses __gamma_p_inv and __gamma_q_inv: refer to the accuracy
+data for those functions for more information.
+But in general results are accurate to a few epsilon, >14 decimnal digits accuracy for 64-but double..
+
+[h4 Implementation]
+
+In the following table /k/ is the shape parameter of the distribution,
+[theta][space] is its scale parameter, /x/ is the random variate, /p/ is the probability
+and /q = 1-p/.
+
+[table
+[[Function][Implementation Notes]]
+[[pdf][Using the relation: pdf = __gamma_p_derivative(k, x / [theta]) / [theta] ]]
+[[cdf][Using the relation: p = __gamma_p(k, x / [theta]) ]]
+[[cdf complement][Using the relation: q = __gamma_q(k, x / [theta]) ]]
+[[quantile][Using the relation: x = [theta][space]* __gamma_p_inv(k, p) ]]
+[[quantile from the complement][Using the relation: x = [theta][space]* __gamma_q_inv(k, p) ]]
+[[mean][k[theta] ]]
+[[variance][k[theta][super 2] ]]
+[[mode][(k-1)[theta][space] for ['k>1] otherwise a __domain_error ]]
+[[skewness][2 / sqrt(k) ]for['k>2] otherwise a __domain_error ] ]
+[[kurtosis][3 + 6 / k]['k>3] otherwise a __domain_error ]]
+[[kurtosis excess][6 / k ]['k>3] otherwise a __domain_error ]]
+]
+
+[endsect][/section:inverse_gamma_dist Inverse Gamma Distribution]
+
+[/
+ Copyright 2010 John Maddock and Paul A. Bristow.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt).
+]
+


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