Re: [Boost-bugs] [Boost C++ Libraries] #11395: boost::math::beta not working for large a, b values

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #11395: boost::math::beta not working for large a, b values
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-06-15 08:49:27


#11395: boost::math::beta not working for large a,b values
--------------------------------------------+-------------------------
  Reporter: Oli Quinet <quinet.olivier@…> | Owner: johnmaddock
      Type: Patches | Status: new
 Milestone: To Be Determined | Component: math
   Version: Boost 1.57.0 | Severity: Problem
Resolution: | Keywords:
--------------------------------------------+-------------------------

Comment (by Oli Quinet <quinet.olivier@…>):

 Here are some mu/rho values that generate large values for the coefficient
 alpha/beta (alpha = mu*(1-rho)/rho and beta = (1-mu)*(1-rho)/rho)):

 mu = 0.959234
 rho = 2.73072e-5
 a (alpha) = 35126.55
 b (beta) = 1492.826

 => expected log(beta(a,b)): l_beta(a, b) = -6241.592

 Performing the calculation in the logarithm scale reduces the cancellation
 errors as it involves adding/subtracting quantities and only taking the
 exp of the sum at the end instead of multiplying/dividing very large/small
 numbers.

 I'm using the binomial_coefficient and beta functions to compute the
 beta_binomial distribution (https://en.wikipedia.org/wiki/Beta-
 binomial_distribution). I.e. in boost notation: pdf(k,
 beta_binomial_dist(n, a, b)) = exp(l_binomial_coefficient(n, k) +
 l_beta(a+k,b+n-k) - l_beta(a, b)).

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11395#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC