Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

scipy.stats.expon.fit() with no location parameter

I am using scipy.stats.expon.fit(data) to fit an exponential distribution to my data. This appears to return two values where I would expect one. The documentation online doesn't seem to say what fit() returns but looking at the source, I am guessing it is both a location and scale parameter. Can you fix the location parameter to 0 when doing the fitting?

like image 719
graffe Avatar asked Aug 01 '14 16:08

graffe


1 Answers

In the call to expon.fit, use floc=0:

In [5]: data = expon.rvs(0, 1.5, 1000)

In [6]: loc, scale = expon.fit(data, floc=0)

In [7]: scale
Out[7]: 1.4878030368336586

In [8]: loc
Out[8]: 0
like image 199
Warren Weckesser Avatar answered Oct 19 '22 18:10

Warren Weckesser