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)

Purpose

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

Syntax

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

Description

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μ0=0 and concentration parameter kappa, κκ, can be written as
θ
Pr(Θθ : κ) = 1/(2πI0(κ))eκcosΘdΘ,
π
Pr(Θθ:κ)=12πI0(κ) -πθeκcosΘdΘ,
where θθ is reduced modulo 2π2π so that πθ < π-πθ<π and κ0κ0. Note that if θ = πθ=π then nag_stat_prob_vonmises (g01er) returns a probability of 11. 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(Θθ : κ) = (1/2) + θ/((2π)) + 1/(πI0(κ))n1In(κ)sinnθ,
n = 1
Pr(Θθ:κ)=12+θ (2π) +1πI0(κ) n=1n-1In(κ)sinnθ,
where In(κ)In(κ) is the modified Bessel function. This series expansion can be represented as a nested expression of terms involving the modified Bessel function ratio RnRn,
Rn(κ) = (In(κ))/(In1(κ)),  n = 1,2,3,,
Rn(κ)=In(κ) In-1(κ) ,  n=1,2,3,,
which is calculated using backwards recursion.
For large values of κκ (see Section [Accuracy]) an asymptotic Normal approximation is used. The angle ΘΘ is transformed to the nearly Normally distributed variate ZZ,
Z = b(κ)sinΘ/2,
Z=b(κ)sinΘ2,
where
b(κ) = (sqrt(2/π) eκ)/(I0(κ))
b(κ)=2π eκ I0(κ)
and b(κ)b(κ) is computed from a continued fraction approximation. An approximation to order κ4κ-4 of the asymptotic normalizing series for zz is then used. Finally the Normal probability integral is evaluated.
For a more detailed analysis of the methods used see Hill (1977).

References

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

Parameters

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.0vk0.0.

Optional Input Parameters

None.

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

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

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry,vk < 0.0vk<0.0 and nag_stat_prob_vonmises (g01er) returns 00.

Accuracy

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.5vk6.5, the other gives an accuracy of 1212 digits and uses the Normal approximation when vk50.0vk50.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θ1θθ2 if the region contains an odd multiple of ππ, (2n + 1)π(2n+1)π. The value of F(θ2;κ)F(θ1;κ)F(θ2;κ)-F(θ1;κ) will be negative and the correct probability should then be obtained by adding one to the value.

Example

function nag_stat_prob_vonmises_example
t = 7;
vk = 0;
[result, ifail] = nag_stat_prob_vonmises(t, vk)
 

result =

    0.6141


ifail =

                    0


function g01er_example
t = 7;
vk = 0;
[result, ifail] = g01er(t, vk)
 

result =

    0.6141


ifail =

                    0



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–2013