Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

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 π$-\pi$ and π$\pi$ 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${\mu }_{0}=0$ and concentration parameter kappa, κ$\kappa$, can be written as
 θ Pr(Θ ≤ θ : κ) = 1/(2πI0(κ)) ∫ eκcosΘdΘ, − π
$Pr(Θ≤θ:κ)=12πI0(κ) ∫-πθeκcos⁡ΘdΘ,$
where θ$\theta$ is reduced modulo 2π$2\pi$ so that πθ < π$-\pi \le \theta <\pi$ and κ0$\kappa \ge 0$. Note that if θ = π$\theta =\pi$ then nag_stat_prob_vonmises (g01er) returns a probability of 1$1$. For very small κ$\kappa$ the distribution is almost the uniform distribution, whereas for κ$\kappa \to \infty$ all the probability is concentrated at one point.
The method of calculation for small κ$\kappa$ involves backwards recursion through a series expansion in terms of modified Bessel functions, while for large κ$\kappa$ an asymptotic Normal approximation is used.
In the case of small κ$\kappa$ the series expansion of Pr(Θθ$\Theta \le \theta$: κ$\kappa$) can be expressed as
 ∞ Pr(Θ ≤ θ : κ) = (1/2) + θ/((2π)) + 1/(πI0(κ)) ∑ n − 1In(κ)sinnθ, n = 1
$Pr(Θ≤θ:κ)=12+θ (2π) +1πI0(κ) ∑n=1∞n-1In(κ)sin⁡nθ,$
where In(κ)${I}_{n}\left(\kappa \right)$ is the modified Bessel function. This series expansion can be represented as a nested expression of terms involving the modified Bessel function ratio Rn${R}_{n}$,
 Rn(κ) = (In(κ))/(In − 1(κ)),  n = 1,2,3, … , $Rn(κ)=In(κ) In-1(κ) , n=1,2,3,…,$
which is calculated using backwards recursion.
For large values of κ$\kappa$ (see Section [Accuracy]) an asymptotic Normal approximation is used. The angle Θ$\Theta$ is transformed to the nearly Normally distributed variate Z$Z$,
 Z = b(κ)sinΘ/2, $Z=b(κ)sin⁡Θ2,$
where
 b(κ) = (sqrt(2/π) eκ)/(I0(κ)) $b(κ)=2π eκ I0(κ)$
and b(κ)$b\left(\kappa \right)$ is computed from a continued fraction approximation. An approximation to order κ4${\kappa }^{-4}$ of the asymptotic normalizing series for z$z$ 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 I0${I}_{0}$: 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
θ$\theta$, the observed von Mises statistic measured in radians.
2:     vk – double scalar
The concentration parameter κ$\kappa$, of the von Mises distribution.
Constraint: vk0.0${\mathbf{vk}}\ge 0.0$.

None.

None.

Output Parameters

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

Error Indicators and Warnings

Errors or warnings detected by the function:
ifail = 1${\mathbf{ifail}}=1$
 On entry, vk < 0.0${\mathbf{vk}}<0.0$ and nag_stat_prob_vonmises (g01er) returns 0$0$.

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.5${\mathbf{vk}}\ge 6.5$, the other gives an accuracy of 12$12$ digits and uses the Normal approximation when vk50.0${\mathbf{vk}}\ge 50.0$.

Using the series expansion for small κ$\kappa$ the time taken by nag_stat_prob_vonmises (g01er) increases linearly with κ$\kappa$; for larger κ$\kappa$, for which the asymptotic Normal approximation is used, the time taken is much less.
If angles outside the region πθ < π$-\pi \le \theta <\pi$ are used care has to be taken in evaluating the probability of being in a region θ1θθ2${\theta }_{1}\le \theta \le {\theta }_{2}$ if the region contains an odd multiple of π$\pi$, (2n + 1)π$\left(2n+1\right)\pi$. The value of F(θ2;κ)F(θ1;κ)$F\left({\theta }_{2}\text{;}\kappa \right)-F\left({\theta }_{1}\text{;}\kappa \right)$ 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