NAG Library Function Document
nag_prob_von_mises (g01erc)
1
Purpose
nag_prob_von_mises (g01erc) returns the probability associated with the lower tail of the von Mises distribution between and .
2
Specification
#include <nag.h> |
#include <nagg01.h> |
double |
nag_prob_von_mises (double t,
double vk,
NagError *fail) |
|
3
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
and concentration argument kappa,
, can be written as
where
is reduced modulo
so that
and
. Note that if
then
nag_prob_von_mises (g01erc) returns a probability of
. 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
where
is the modified Bessel function. This series expansion can be represented as a nested expression of terms involving the modified Bessel function ratio
,
which is calculated using backwards recursion.
For large values of
(see
Section 7) an asymptotic Normal approximation is used. The angle
is transformed to the nearly Normally distributed variate
,
where
and
is computed from a continued fraction approximation. An approximation to order
of the asymptotic normalizing series for
is then used. Finally the Normal probability integral is evaluated.
For a more detailed analysis of the methods used see
Hill (1977).
4
References
Hill G W (1977) Algorithm 518: Incomplete Bessel function : The Von Mises distribution ACM Trans. Math. Software 3 279–284
Mardia K V (1972) Statistics of Directional Data Academic Press
5
Arguments
- 1:
– doubleInput
-
On entry: , the observed von Mises statistic measured in radians.
- 2:
– doubleInput
-
On entry: the concentration parameter , of the von Mises distribution.
Constraint:
.
- 3:
– NagError *Input/Output
-
The NAG error argument (see
Section 3.7 in How to Use the NAG Library and its Documentation).
6
Error Indicators and Warnings
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
See
Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
- NE_INTERNAL_ERROR
-
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact
NAG for assistance.
See
Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
- NE_NO_LICENCE
-
Your licence key may have expired or may not have been installed correctly.
See
Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
- NE_REAL
-
On entry, .
Constraint: .
7
Accuracy
nag_prob_von_mises (g01erc) 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 , the other gives an accuracy of digits and uses the Normal approximation when .
8
Parallelism and Performance
nag_prob_von_mises (g01erc) is not threaded in any implementation.
Using the series expansion for small the time taken by nag_prob_von_mises (g01erc) 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 if the region contains an odd multiple of , . The value of will be negative and the correct probability should then be obtained by adding one to the value.
10
Example
This example inputs four values from the von Mises distribution along with the values of the argument . The probabilities are computed and printed.
10.1
Program Text
Program Text (g01erce.c)
10.2
Program Data
Program Data (g01erce.d)
10.3
Program Results
Program Results (g01erce.r)