Why doesn't my Rician in Sympy match the Rician in Scipy?

不羁的心 提交于 2019-12-04 19:08:35

The implementation of the Rice distribution in scipy.stats.rice uses a slightly different parameterization than the parameterization described in the wikipedia article.

To make your plots agree, change this line

Rsci=scst.rice(pr,scale=sigma)

to

Rsci=scst.rice(pr/sigma, scale=sigma)

Here's a longer explanation:

The PDF shown on wikipedia is

The PDF in the docstring of scipy.stats.rice is

However, that formula does not show the scale parameter that all of the continuous distributions in scipy have. (It also doesn't show the location parameter loc, but I'll assume there is no interest in using a Rice distribution with a nonzero location.) To create the formula that includes the scale parameter, we use the standard scale family of a PDF:

So the scipy PDF is actually

If we make the identifications

we obtain the PDF shown in the wikipedia article.

In your code, your parameter pr is ν, so to convert to scipy's parameterization, you must use b = pr / sigma.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!