[SciPy-User] scipy.stats beginner: help with fitting distribution
Arvind Thiagarajan
t.arvind@gmail....
Mon Mar 18 13:46:06 CDT 2013
Hi all,
I'm a beginner with SciPy so this may be a basic question. I am trying
to fit a Rice distribution to some data using scipy.stats.
However, I first tried some test code which doesn't seem to give me a
very good fit. I tried the following code:
>>> b = [0.3,]
>>> samples = rice.rvs(b, loc=0, scale=1, size=1000)
>>> rice.fit(samples)
(0.0012012190480231357, -0.0023216862043629813, 1.024758538166374)
Though the loc and scale seem ok (close to 0 and 1 respectively), I
was hoping the first return value would be closer to 0.3 since the
shape parameter I supplied while generating random samples was 0.3 (in
the call to rvs).
I initially thought 1000 samples was perhaps too few, but get
similarly poor results with 10,000 samples as well. Concluded that I
must be doing something wrong, or that I'm misinterpreting the usage
for the rvs() or fit() functions. Is the fit function supposed to try
to approximately find the same shape parameter I passed in to rvs? Or
should I be interpreting the fit result differently?
Wondering if anyone has any ideas?
Thanks a lot,
Arvind
More information about the SciPy-User
mailing list