[SciPy-User] scipy.stats beginner: help with fitting distribution

Arvind Thiagarajan t.arvind at gmail.com
Mon Mar 18 15:57:13 EDT 2013


Thanks Josef. I played around a bit more and in the Rice case, it
appears the estimation is accurate only if loc and scale are supplied
--- the fit is unable to estimate all three together accurately. Also,
the estimation seems only accurate for larger values of the shape
parameter. Just mentioning this for anyone else who may see similar
problems.

Thanks,
Arvind

On Mon, Mar 18, 2013 at 12:28 PM,  <josef.pktd at gmail.com> wrote:
> On Mon, Mar 18, 2013 at 2:46 PM, Arvind Thiagarajan <t.arvind at gmail.com> 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)
>>>>> 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?
>
> general answer:
> http://stackoverflow.com/questions/15468215/python-scipy-stats-pareto-fit-how-does-it-work
>
> 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.
>
> Josef
>
>>
>> Thanks a lot,
>> Arvind
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user



More information about the SciPy-User mailing list