I'm trying to fit a von Mises distribution, from scipy (http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.vonmises.html)
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.
What is the returning value? Ifeel the second is loc, or mean value. But have no idea what the first returned value is.
And how should I fit a von mises distribution?
Python is commonly used for developing websites and software, task automation, data analysis, and data visualization. Since it's relatively easy to learn, Python has been adopted by many non-programmers such as accountants and scientists, for a variety of everyday tasks, like organizing finances.
The Python += operator lets you add two values together and assign the resultant value to a variable. This operator is often referred to as the addition assignment operator.
Python is written in C (actually the default implementation is called CPython).
Python is widely considered among the easiest programming languages for beginners to learn. If you're interested in learning a programming language, Python is a good place to start. It's also one of the most widely used.
The returned values are kappa, loc and scale. Unfortunately, the von Mises pdf does not seem to yield itself to fitting. It does fit correctly if you fix the scale:
>>> vonmises.fit(r, fscale=1)
(2.994517240859579, -0.0080482378119089287, 1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With