| Type: | Package |
| Title: | Sampling from the von Mises-Fisher Distribution |
| Version: | 0.0.4 |
| Date: | 2025-12-01 |
| Description: | Provides fast sampling from von Mises-Fisher distribution using the method proposed by Andrew T.A Wood (1994) <doi:10.1080/03610919408813161>. |
| License: | GPL-3 |
| Encoding: | UTF-8 |
| BugReports: | https://github.com/ahoundetoungan/vMF/issues |
| URL: | https://github.com/ahoundetoungan/vMF |
| Depends: | R (≥ 3.5.0) |
| Imports: | Rcpp |
| LinkingTo: | Rcpp, RcppArmadillo |
| Suggests: | movMF, rbenchmark, knitr, rmarkdown, ggplot2 |
| RoxygenNote: | 7.3.2 |
| VignetteBuilder: | knitr |
| NeedsCompilation: | yes |
| Packaged: | 2025-11-09 16:35:59 UTC; haache |
| Author: | Aristide Houndetoungan [cre, aut] |
| Maintainer: | Aristide Houndetoungan <ahoundetoungan@ecn.ulaval.ca> |
| Repository: | CRAN |
| Date/Publication: | 2025-11-09 20:10:02 UTC |
Sample from von Mises - Fisher distribution
Description
vMF samples from von Mises-Fisher distribution and performs some operations. Unlike themovMF package, vMF does not consider mixtures of von Mises-Fisher distribution.vFM particularly focuses on sampling from the distribution and performs it very quickly. This is useful to carry out fast simulations in directional statistics.vMF also computes the density and normalization constant of the von Mises-Fisher distribution.
Author(s)
Aristide Houndetoungan <ariel92and@gmail.com>
References
Wood, A. T. (1994). Simulation of the von Mises Fisher distribution.Communications in statistics-simulation and computation, 23(1), 157-164.doi:10.1080/03610919408813161.
Hornik, K., & Grun, B. (2014).movMF: AnR package for fitting mixtures of von Mises-Fisher distributions.Journal of Statistical Software, 58(10), 1-31.doi:10.18637/jss.v058.i10.
See Also
Useful links:
Normalization constant of von Mises - Fisher distribution.
Description
CpvMF returns the normalization constant of von Mises - Fisher density.
Usage
CpvMF(p, k)Arguments
p | as sphere dimension. |
k | as the intensity parameter. |
Details
The probability density function of the von Mises - Fisher distribution is defined by :
f(z|theta) = C_p(|theta|)\exp{(z theta)}
|theta| is the intensity parameter and\frac{theta}{|theta|} the mean directional parameter. The normalization constantC_p() depends on the Bessel function of the first kind. See more detailshere.
Value
the normalization constant.
References
Wood, A. T. (1994). Simulation of the von Mises Fisher distribution.Communications in statistics-simulation and computation, 23(1), 157-164.doi:10.1080/03610919408813161.
Hornik, K., & Grun, B. (2014).movMF: AnR package for fitting mixtures of von Mises-Fisher distributions.Journal of Statistical Software, 58(10), 1-31.doi:10.18637/jss.v058.i10.
See Also
Examples
CpvMF(2,3.1)PDF of the von Mises - Fisher distribution.
Description
dvMF computes the density of the von Mises - Fisher distribution, given a set of spherical coordinates and the distribution parameters.
Usage
dvMF(z, theta)Arguments
z | as the set of points at which the spherical coordinate will be evaluated. z may be an one row matrix or vector if it contain one spherical coordinates or amatrix whose each row is one spherical coordinates. |
theta | as the distribution parameter. |
Details
The probability density function of the von Mises - Fisher distribution is defined by :
f(z|theta) = C_p(|theta|)\exp{(z theta)}
|theta| is the intensity parameter and\frac{theta}{|theta|} the mean directional parameter. The normalization constantC_p() depends on the Bessel function of the first kind. See more detailshere.
Value
the densities computed at each point
Author(s)
Aristide Houndetoungan <ariel92and@gmail.com>
References
Wood, A. T. (1994). Simulation of the von Mises Fisher distribution.Communications in statistics-simulation and computation, 23(1), 157-164.doi:10.1080/03610919408813161.
Hornik, K., & Grun, B. (2014).movMF: AnR package for fitting mixtures of von Mises-Fisher distributions.Journal of Statistical Software, 58(10), 1-31.doi:10.18637/jss.v058.i10.
See Also
rvMF andCpvMF
Examples
{}# Draw 1000 vectors from vM-F with parameter 1, (1,0)z <- rvMF(1000,c(1,0))# Compute the density at these pointsdvMF(z,c(1,0))# Density of (0,1,0,0) with the parameter 3, (0,1,0,0)dvMF(c(0,1,0,0),c(0,3,0,0))Sample from von Mises - Fisher distribution.
Description
rvMF returns random draws from von Mises - Fisher distribution.
Usage
rvMF(size, theta)Arguments
size | as the number of draws needed. |
theta | as the distribution parameter. |
Details
The parameter theta is such thatdim(theta) is the sphere dimension,|theta| the intensity parameter and\frac{theta}{|theta|} the mean directional parameter.
Value
A matrix whose each row is a random draw from the distribution.
References
Wood, A. T. (1994). Simulation of the von Mises Fisher distribution.Communications in statistics-simulation and computation, 23(1), 157-164.doi:10.1080/03610919408813161.
Hornik, K., & Grun, B. (2014).movMF: AnR package for fitting mixtures of von Mises-Fisher distributions.Journal of Statistical Software, 58(10), 1-31.doi:10.18637/jss.v058.i10.
Examples
# Draw 1000 vectors from vM-F with parameter 1, (1,0)rvMF(1000,c(1,0))# Draw 10 vectors from vM-F with parameter sqrt(14), (2,1,3)rvMF(10,c(2,1,3))# Draw from the vMF distribution with mean direction proportional # to c(1, -1) and concentration parameter 3rvMF(10, 3 * c(1, -1) / sqrt(2))