bundles / scipy latest / scipy / stats / _continuous_distns / vonmises_gen
class
scipy.stats._continuous_distns:vonmises_gen
Signature
class vonmises_gen ( momtype = 1 , a = None , b = None , xtol = 1e-14 , badvalue = None , name = None , longname = None , shapes = None , seed = None ) Members
Summary
A Von Mises continuous random variable.
Extended Summary
%(before_notes)s
Notes
The probability density function for vonmises and vonmises_line is:
for , . is the modified Bessel function of order zero (scipy.special.i0).
vonmises is a circular distribution which does not restrict the distribution to a fixed interval. Currently, there is no circular distribution framework in SciPy. The cdf is implemented such that cdf(x + 2*np.pi) == cdf(x) + 1.
vonmises_line is the same distribution, defined on on the real line. This is a regular (i.e. non-circular) distribution.
Note about distribution parameters: vonmises and vonmises_line take kappa as a shape parameter (concentration) and loc as the location (circular mean). A scale parameter is accepted but does not have any effect.
Examples
Import the necessary modules.import numpy as np import matplotlib.pyplot as plt from scipy.stats import vonmises✓
loc = 0.5 * np.pi # circular mean kappa = 1 # concentration✓
vonmises.pdf(0, loc=loc, kappa=kappa)
✗x = 1 cdf_value = vonmises.cdf(x, loc=loc, kappa=kappa) ppf_value = vonmises.ppf(cdf_value, loc=loc, kappa=kappa)✓
x, cdf_value, ppf_value
✗sample_size = 1000 sample = vonmises(loc=loc, kappa=kappa).rvs(sample_size)✓
fig = plt.figure(figsize=(12, 6)) left = plt.subplot(121) right = plt.subplot(122, projection='polar') x = np.linspace(-np.pi, np.pi, 500) vonmises_pdf = vonmises.pdf(x, loc=loc, kappa=kappa) ticks = [0, 0.15, 0.3]✓
left.plot(x, vonmises_pdf) left.set_yticks(ticks)✗
number_of_bins = int(np.sqrt(sample_size))
✓left.hist(sample, density=True, bins=number_of_bins) left.set_title("Cartesian plot") left.set_xlim(-np.pi, np.pi)✗
left.grid(True)
✓right.plot(x, vonmises_pdf, label="PDF") right.set_yticks(ticks) right.hist(sample, density=True, bins=number_of_bins, label="Histogram") right.set_title("Polar plot") right.legend(bbox_to_anchor=(0.15, 1.06))✗
See also
- scipy.stats.vonmises_fisher
Von-Mises Fisher distribution on a hypersphere
Aliases
-
scipy.stats._continuous_distns.vonmises_gen