Fitting distribution with fixed parameters in SciPy

Is it possible to fix parameters while fitting distributions in SciPy? For example, this code:

import scipy.stats as st
xx = st.expon.rvs(size=100)
print, loc=0)

results in non-zero location (loc).

When some parameter is provided to the fit function it is considered as an initial guess. And if it is provided to the constructor (st.expon(loc=0)) the distribution becomes "frozen" and can not be used for fitting.


To fix loc, use the argument floc:

print, floc=0)


In [33]: import scipy.stats as st

In [34]: xx = st.expon.rvs(size=100)

In [35]: print, floc=0)
(0, 0.77853895325584932)

Some related questions:

Need Your Help

Having trouble putting reusable code into a subroutine

c++ visual-c++ bitblt

I am trying to understand better the quirks of Visual C++. As such, I have come to the stage where I make a program that starts out as an empty window, but as you click around, a check board of red...

How to programatically take a screenshot in Sprite-Kit?

ios uiimage screenshot sprite-kit

I've been reading resolved questions on how to programmatically take a screenshot but I can't seem to get what I've read to work in sprite kit. For instance: