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 st.expon.fit(xx, 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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…