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

josef.pktd@gmai... josef.pktd@gmai...
Mon Mar 18 15:37:28 CDT 2013


On Mon, Mar 18, 2013 at 3:57 PM, Arvind Thiagarajan <t.arvind@gmail.com> wrote:
> 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.

quick look:
http://en.wikipedia.org/wiki/Rice_distribution#Parameter_estimation_.28the_Koay_inversion_technique.29
maybe it should work if loc is fixed.

Josef


>
> Thanks,
> Arvind
>
> On Mon, Mar 18, 2013 at 12:28 PM,  <josef.pktd@gmail.com> wrote:
>> On Mon, Mar 18, 2013 at 2:46 PM, Arvind Thiagarajan <t.arvind@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@scipy.org
>>> http://mail.scipy.org/mailman/listinfo/scipy-user
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user


More information about the SciPy-User mailing list