[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gsl] [bug #47646] gsl_ran_beta returns NaN for small arguments
From: |
Alexey Radul |
Subject: |
[Bug-gsl] [bug #47646] gsl_ran_beta returns NaN for small arguments |
Date: |
Thu, 07 Apr 2016 22:15:33 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 |
URL:
<http://savannah.gnu.org/bugs/?47646>
Summary: gsl_ran_beta returns NaN for small arguments
Project: GNU Scientific Library
Submitted by: axch
Submitted on: Thu 07 Apr 2016 10:15:31 PM GMT
Category: Accuracy problem
Severity: 3 - Normal
Operating System: Ubuntu 14.04
Status: None
Assigned to: None
Open/Closed: Open
Release: 1.16
Discussion Lock: Any
_______________________________________________________
Details:
Calling, for example, gsl_ran_beta(rng, 1e-5, 1e-5), returns NaN most of the
time. Expected behavior is to return 0.0 or 1.0 most of the time (equal
probability of each).
Presumably this is due to both calls to gsl_ran_gamma(rng, 1e-5, 1.0) in the
body of gsl_ran_beta returning 0 fairly often, which is not unreasonable
behavior for sampling a gamma with so small of a shape parameter.
For an example alternative, numpy has a different control path when a and b
are both <= 1:
https://github.com/numpy/numpy/blob/master/numpy/random/mtrand/distributions.c#L188-L218
This came up in a computational investigation of a Polya-tree style
representation of a Dirichlet process (context: Bayesian non-parametrics).
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?47646>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug-gsl] [bug #47646] gsl_ran_beta returns NaN for small arguments,
Alexey Radul <=