g01er returns the probability associated with the lower tail of the von Mises distribution between $-\pi $ and $\pi $ through the function name.

# Syntax

C# |
---|

public static double g01er( double t, double vk, out int ifail ) |

Visual Basic |
---|

Public Shared Function g01er ( _ t As Double, _ vk As Double, _ <OutAttribute> ByRef ifail As Integer _ ) As Double |

Visual C++ |
---|

public: static double g01er( double t, double vk, [OutAttribute] int% ifail ) |

F# |
---|

static member g01er : t : float * vk : float * ifail : int byref -> float |

#### Parameters

- t
- Type: System..::..Double
*On entry*: $\theta $, the observed von Mises statistic measured in radians.

- vk
- Type: System..::..Double
*On entry*: the concentration parameter $\kappa $, of the von Mises distribution.*Constraint*: ${\mathbf{vk}}\ge 0.0$.

- ifail
- Type: System..::..Int32%
*On exit*: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

#### Return Value

g01er returns the probability associated with the lower tail of the von Mises distribution between $-\pi $ and $\pi $ through the function name.

# 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 ${\mu}_{0}=0$ and concentration parameter kappa, $\kappa $, can be written as

where $\theta $ is reduced modulo $2\pi $ so that $-\pi \le \theta <\pi $ and $\kappa \ge 0$. Note that if $\theta =\pi $ then g01er returns a probability of $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.

$$\mathrm{Pr}\left(\Theta \le \theta :\kappa \right)=\frac{1}{2\pi {I}_{0}\left(\kappa \right)}\underset{-\pi}{\overset{\theta}{\int}}{e}^{\kappa \mathrm{cos}\u200a\Theta}\mathrm{d}\Theta \text{,}$$ |

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

where ${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 ${R}_{n}$,

which is calculated using backwards recursion.

$$\mathrm{Pr}\left(\Theta \le \theta :\kappa \right)=\frac{1}{2}+\frac{\theta}{\left(2\pi \right)}+\frac{1}{\pi {I}_{0}\left(\kappa \right)}\sum _{n=1}^{\infty}{n}^{-1}{I}_{n}\left(\kappa \right)\mathrm{sin}\u200an\theta \text{,}$$ |

$${R}_{n}\left(\kappa \right)=\frac{{I}_{n}\left(\kappa \right)}{{I}_{n-1}\left(\kappa \right)}\text{, \hspace{1em}}n=1,2,3,\dots \text{,}$$ |

For large values of $\kappa $ (see [Accuracy]) an asymptotic Normal approximation is used. The angle $\Theta $ is transformed to the nearly Normally distributed variate $Z$,

where

and $b\left(\kappa \right)$ is computed from a continued fraction approximation. An approximation to order ${\kappa}^{-4}$ of the asymptotic normalizing series for $z$ is then used. Finally the Normal probability integral is evaluated.

$$Z=b\left(\kappa \right)\mathrm{sin}\u200a\frac{\Theta}{2}\text{,}$$ |

$$b\left(\kappa \right)=\frac{\sqrt{\frac{2}{\pi}}{e}^{\kappa}}{{I}_{0}\left(\kappa \right)}$$ |

For a more detailed analysis of the methods used see Hill (1977).

# References

Hill G W (1977) Algorithm 518: Incomplete Bessel function ${I}_{0}$: The Von Mises distribution

*ACM Trans. Math. Software***3**279–284Mardia K V (1972)

*Statistics of Directional Data*Academic Press# Error Indicators and Warnings

Errors or warnings detected by the method:

- ${\mathbf{ifail}}=1$
On entry, ${\mathbf{vk}}<0.0$ and g01er returns $0$.

# Accuracy

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

# Parallelism and Performance

None.

# Further Comments

Using the series expansion for small $\kappa $ the time taken by 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 ${\theta}_{1}\le \theta \le {\theta}_{2}$ if the region contains an odd multiple of $\pi $, $\left(2n+1\right)\pi $. The value of $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

This example inputs four values from the von Mises distribution along with the values of the parameter $\kappa $. The probabilities are computed and printed.

Example program (C#): g01ere.cs