Question

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?

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top