简体   繁体   English

Python&Scipy:如何适应von mises发行版?

[英]Python & Scipy: How to fit a von mises distribution?

I'm trying to fit a von Mises distribution, from scipy ( http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.vonmises.html ) 我正试图从scipy( http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.vonmises.html )中修改von Mises发行版。

So I tried 所以我试过了

from scipy.stats import vonmises
kappa = 3
r = vonmises.rvs(kappa, size=1000)
plt.hist(r, normed=True,alpha=0.2)

It returns 它回来了

在此输入图像描述

However, when I fit the data on it 但是,当我在其上拟合数据时

vonmises.fit(r)
# returns (1.2222011312461918, 0.024913780423670054, 2.4243546157480105e-30)

vonmises.fit(r, loc=0, scale=1)
# returns (1.549290021706847, 0.0013319431181202394, 7.1653626652619939e-29)

But none of the value returned is the parameter of Von Mises, kappa. 但是返回的值都不是Von Mises,kappa的参数。

What is the returning value? 返回值是多少? Ifeel the second is loc, or mean value. 我觉得第二个是loc,或者是平均值。 But have no idea what the first returned value is. 但不知道第一个返回值是什么。

And how should I fit a von mises distribution? 我应该如何适应von mises发行版?

The returned values are kappa, loc and scale. 返回的值是kappa,loc和scale。 Unfortunately, the von Mises pdf does not seem to yield itself to fitting. 不幸的是,von Mises pdf似乎并没有让自己屈服。 It does fit correctly if you fix the scale: 如果您修复比例,它确实适合:

>>> vonmises.fit(r, fscale=1)
(2.994517240859579, -0.0080482378119089287, 1)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM