hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_stat_prob_vonmises (g01er)


    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example


nag_stat_prob_vonmises (g01er) returns the probability associated with the lower tail of the von Mises distribution between -π and π through the function name.


[result, ifail] = g01er(t, vk)
[result, ifail] = nag_stat_prob_vonmises(t, vk)


The von Mises distribution is a symmetric distribution used in the analysis of circular data. The lower tail area of this distribution on the circle with mean direction μ0=0 and concentration argument kappa, κ, can be written as
PrΘθ:κ=12πI0κ -πθeκcosΘdΘ,  
where θ is reduced modulo 2π so that -πθ<π and κ0. Note that if θ=π then nag_stat_prob_vonmises (g01er) returns a probability of 1. For very small κ the distribution is almost the uniform distribution, whereas for κ all the probability is concentrated at one point.
The method of calculation for small κ involves backwards recursion through a series expansion in terms of modified Bessel functions, while for large κ an asymptotic Normal approximation is used.
In the case of small κ the series expansion of Pr(Θθ: κ) can be expressed as
PrΘθ:κ=12+θ 2π +1πI0κ n=1n-1Inκsinnθ,  
where Inκ is the modified Bessel function. This series expansion can be represented as a nested expression of terms involving the modified Bessel function ratio Rn,
Rnκ=Inκ In-1κ ,  n=1,2,3,,  
which is calculated using backwards recursion.
For large values of κ (see Accuracy) an asymptotic Normal approximation is used. The angle Θ is transformed to the nearly Normally distributed variate Z,
bκ=2π eκ I0κ  
and bκ is computed from a continued fraction approximation. An approximation to order κ-4 of the asymptotic normalizing series for z is then used. Finally the Normal probability integral is evaluated.
For a more detailed analysis of the methods used see Hill (1977).


Hill G W (1977) Algorithm 518: Incomplete Bessel function I0: The Von Mises distribution ACM Trans. Math. Software 3 279–284
Mardia K V (1972) Statistics of Directional Data Academic Press


Compulsory Input Parameters

1:     t – double scalar
θ, the observed von Mises statistic measured in radians.
2:     vk – double scalar
The concentration parameter κ, of the von Mises distribution.
Constraint: vk0.0.

Optional Input Parameters


Output Parameters

1:     result – double scalar
The result of the function.
2:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
On entry,vk<0.0 and nag_stat_prob_vonmises (g01er) returns 0.
An unexpected error has been triggered by this routine. Please contact NAG.
Your licence key may have expired or may not have been installed correctly.
Dynamic memory allocation failed.


nag_stat_prob_vonmises (g01er) uses one of two sets of constants depending on the value of machine precision. One set gives an accuracy of six digits and uses the Normal approximation when vk6.5, the other gives an accuracy of 12 digits and uses the Normal approximation when vk50.0.

Further Comments

Using the series expansion for small κ the time taken by nag_stat_prob_vonmises (g01er) increases linearly with κ; for larger κ, for which the asymptotic Normal approximation is used, the time taken is much less.
If angles outside the region -πθ<π are used care has to be taken in evaluating the probability of being in a region θ1θθ2 if the region contains an odd multiple of π, 2n+1π. The value of Fθ2;κ-Fθ1;κ will be negative and the correct probability should then be obtained by adding one to the value.


This example inputs four values from the von Mises distribution along with the values of the argument κ. The probabilities are computed and printed.
function g01er_example

fprintf('g01er example results\n\n');

% Lower tail probabilities for Von Mises distribution
t  = [7; 2.8; 1.0; -1.4];
vk = [0; 2.4; 1.0;  1.3];

fprintf('     t         vk     probability\n');
for j = 1:numel(t)

          [p, ifail] = g01er( ...
                              t(j), vk(j));

  fprintf('%9.4f%10.4f%12.4f\n', t(j), vk(j), p);

g01er example results

     t         vk     probability
   7.0000    0.0000      0.6141
   2.8000    2.4000      0.9983
   1.0000    1.0000      0.7944
  -1.4000    1.3000      0.1016

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015