[Scipy-tickets] [SciPy] #1866: Beta distribution pdf returns nan/inf values for large parameter values

SciPy Trac scipy-tickets@scipy....
Thu Mar 14 14:24:14 CDT 2013


#1866: Beta distribution pdf returns nan/inf values for large parameter values
-----------------------------+----------------------------------------------
 Reporter:  chrisfonnesbeck  |       Owner:  somebody   
     Type:  defect           |      Status:  new        
 Priority:  normal           |   Milestone:  Unscheduled
Component:  Other            |     Version:  devel      
 Keywords:                   |  
-----------------------------+----------------------------------------------
 The beta distribution is not able to handle large (not extremely large)
 parameter values when calculating the pdf or logpdf. For example:


 {{{
 In [2]: alpha, beta = 267, 1472

 In [3]: %paste
 from scipy.stats import distributions as dist

 b = dist.beta(alpha, beta)
 b.pdf([0.2, 0.5, 0.6])

 ## -- End pasted text --
 Out[3]: array([ nan,  nan,  nan])

 In [4]: b.logpdf([0.2, 0.5, 0.6])
 Out[4]: array([ inf,  inf,  inf])
 }}}

 Again, a beta with parameters 267, 1472 are large, but should not cause
 numerical problems. For example, I can get the log-pdf easily in PyMC:

 {{{
 In [5]: from pymc import beta_like

 In [6]: beta_like([0.2, 0.5, 0.6], alpha, beta)
 Out[6]: -1201.699061824062
 }}}

 (the PyMC implementation returns the sum of the log-pdfs, but clearly this
 is not an unreasonable parameterization.

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1866>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list