In a comment I said you have run into a bug in the gamma
distribution--it does not let you fix both the location and the scale. The bug was fixed in scipy 0.13, but if you can't upgrade, you can work around the bug by using the fit
method of the class rv_continuous
, which is the parent class of gamma
:
In [22]: from scipy.stats import rv_continuous, gamma
In [23]: x = gamma.rvs(2.5, loc=0, scale=4, size=1000) # A test sample.
In [24]: rv_continuous.fit(gamma, x, floc=0, fscale=4)
Out[24]: (2.5335837650122608, 0, 4)