[SciPy-Dev] scipy.stats.distributions: note on initial parameters for fitting the beta distribution

James Phillips zunzun@zunzun....
Mon Nov 8 10:43:09 CST 2010


I am finding that using eps alone is insufficient, as the size of a
given floating point number may be too large to add or subtract eps
and have the floating point number change.  Below is example code that
on my 32-bit Ubuntu Linux distribution illustrates my meaning.

     James


import numpy

eps = numpy.finfo(float).eps
print 'eps =', eps

a = 500.0
b = 500.0
print 'should be zero: a-b =', a-b

c = b + eps
print 'should be -eps, not zero: a-c =', a-c


d = 1.0E-290
e = 1.0E-290
print 'should be zero: d-e =', d-e

f = e + eps
print 'should be -eps, not zero: a-c =', d-f



On Mon, Oct 25, 2010 at 10:14 AM,  <josef.pktd@gmail.com> wrote:
>
> Are you handling fixed loc and scale in your code? In that case, it
> might be possible just to restrict the usage of the beta distribution
> for data between zero and one, or fix loc=x.min()-eps, scale=(x.max()
> - x.min() + 2*eps) or something like this, if you don't want to get
> another estimation method. (I don't remember if I tried this for the
> beta distribution.)


More information about the SciPy-Dev mailing list