[SciPy-User] scipy.stats beginner: help with fitting distribution
Mon Mar 18 14:28:32 CDT 2013
On Mon, Mar 18, 2013 at 2:46 PM, Arvind Thiagarajan <firstname.lastname@example.org> wrote:
> 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)
> (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?
For some distributions it helps to try out different starting values.
For some distributions, the maximum likelihood estimation does not
work (like pareto if we want to estimate also loc), either curvature
problems or likelihood can go to infinite.
I don't know anything about the rice distributions, and don't know how
difficult it is to estimate the parameters.
> Thanks a lot,
> SciPy-User mailing list
More information about the SciPy-User