CDF of VOn Mises distribution

조회 수: 47 (최근 30일)
Aep
Aep 2021년 8월 18일
편집: David Goodmanson 2021년 8월 19일
Hello all,
How can I calculate cdf of Von Mises distribution with MATLAB?
An explanation about Von Mises distribution is provided in this Wikipedia page.
Thanks
  댓글 수: 4
Aep
Aep 2021년 8월 18일
편집: Aep 2021년 8월 18일
Thanks @KSSV. I had searched in the circular statistics toolbox, however it seems that it does not calculate the CDF of Von Mises distribution. The other code that you sent also, as far as I understood, generates random Von Mises distribution, but it does not calculate CDF.

댓글을 달려면 로그인하십시오.

답변 (3개)

David Goodmanson
David Goodmanson 2021년 8월 18일
편집: David Goodmanson 2021년 8월 19일
HI Aep,
This is straight numerical integration and provides the cdf at 1e6 equally spaced points in theta, from -pi to pi.
kappa = 3;
mu = 1;
theta = linspace(-pi,pi,1e6);
f = exp(kappa*cos(theta-mu))/(2*pi*besseli(0,kappa));
c = cumtrapz(theta,f); % cdf
plot(theta,c)
c(end)-1 % check to see how close the last point of the cdf is to 1
ans = 2.0650e-14
% assume a set of angles theta1 with -pi <= theta1 <= pi;
theta1 = [.7 1.4 2.1];
c1 = interp1(theta,c,theta1,'spline')
c1 = 0.3148 0.7455 0.9578
For any reasonable kappa the last point of the cdf will be very close to 1, but the look of the plot depends on how far the maximum of f (at theta = mu) is from the starting point. Here the starting point is -pi, but it could be anywhere on the circle.
For an array of input angles of your choosing, interp1 provides the result.

Paul
Paul 2021년 8월 18일
This code seems to recreate one of the CDF plots on the linked wikipedia page. It doesn't run very fast.
syms x mu kappa x0 real
syms j integer
phi(x,mu,kappa) = 1/2/sym(pi)*(x + 2/besseli(0,kappa)*symsum(besseli(j,kappa)*sin(j*(x-mu))/j,j,1,inf));
F(x,mu,kappa,x0) = phi(x,mu,kappa) - phi(x0,mu,kappa);
cdf = F(-pi:.1:pi,0,1,-pi); % mu = 0, kappa = 1, support from -pi to pi
plot(-pi:.1:pi,double(cdf))
xlim([-pi pi]);
set(gca,'XTick',(-1:.5:1)*pi);
set(gca,'XMinorTick','on');
set(gca,'XMinorGrid','on');
grid

Jeff Miller
Jeff Miller 2021년 8월 19일
The Von Mises distribution is included in Cupid. You could use it like this to calculate CDF values:
>> location = 10;
>> concentration = 1.5;
>> vm = VonMises(location,concentration);
>> vm.CDF(11)
ans =
0.84863

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by