Title: | Sampling from the von Mises-Fisher Distribution |
---|---|
Description: | Provides fast sampling from von Mises-Fisher distribution using the method proposed by Andrew T.A Wood (1994) <doi:10.1080/03610919408813161>. |
Authors: | Aristide Houndetoungan [cre, aut] |
Maintainer: | Aristide Houndetoungan <[email protected]> |
License: | GPL-3 |
Version: | 0.0.2 |
Built: | 2024-11-07 04:27:39 UTC |
Source: | https://github.com/ahoundetoungan/vmf |
CpvMF
returns the normalization constant of von Mises - Fisher density.
CpvMF(p, k)
CpvMF(p, k)
p |
as sphere dimension. |
k |
as the intensity parameter. |
The probability density function of the von Mises - Fisher distribution is defined by :
is the intensity parameter and
the mean directional parameter. The normalization constant
depends
on the Bessel function of the first kind. See more details here.
the normalization constant.
Wood, A. T. (1994). Simulation of the von Mises Fisher distribution. Communications in statistics-simulation and computation, 23(1), 157-164. https://www.tandfonline.com/doi/abs/10.1080/03610919408813161.
Hornik, K., & Grun, B. (2014). movMF: An R package for fitting mixtures of von Mises-Fisher distributions. Journal of Statistical Software, 58(10), 1-31. https://epub.wu.ac.at/4893/.
CpvMF(2,3.1)
CpvMF(2,3.1)
dvMF
computes the density of the von Mises - Fisher distribution, given a set of spherical coordinates and the distribution parameters.
dvMF(z, theta)
dvMF(z, theta)
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 a matrix whose each row is one spherical coordinates. |
theta |
as the distribution parameter. |
The probability density function of the von Mises - Fisher distribution is defined by :
is the intensity parameter and
the mean directional parameter. The normalization constant
depends
on the Bessel function of the first kind. See more details here.
the densities computed at each point
Aristide Houndetoungan <[email protected]>
Wood, A. T. (1994). Simulation of the von Mises Fisher distribution. Communications in statistics-simulation and computation, 23(1), 157-164. https://www.tandfonline.com/doi/abs/10.1080/03610919408813161.
Hornik, K., & Grun, B. (2014). movMF: An R package for fitting mixtures of von Mises-Fisher distributions. Journal of Statistical Software, 58(10), 1-31. https://epub.wu.ac.at/4893/.
rvMF
and CpvMF
{} # Draw 1000 vectors from vM-F with parameter 1, (1,0) z <- rvMF(1000,c(1,0)) # Compute the density at these points dvMF(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))
{} # Draw 1000 vectors from vM-F with parameter 1, (1,0) z <- rvMF(1000,c(1,0)) # Compute the density at these points dvMF(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))
rvMF
returns random draws from von Mises - Fisher distribution.
rvMF(size, theta)
rvMF(size, theta)
size |
as the number of draws needed. |
theta |
as the distribution parameter. |
The parameter theta is such that is the sphere dimension,
the intensity parameter and
the mean directional parameter.
A matrix whose each row is a random draw from the distribution.
Wood, A. T. (1994). Simulation of the von Mises Fisher distribution. Communications in statistics-simulation and computation, 23(1), 157-164. https://www.tandfonline.com/doi/abs/10.1080/03610919408813161.
Hornik, K., & Grun, B. (2014). movMF: An R package for fitting mixtures of von Mises-Fisher distributions. Journal of Statistical Software, 58(10), 1-31. https://epub.wu.ac.at/4893/.
# 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 3 rvMF(10, 3 * c(1, -1) / sqrt(2))
# 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 3 rvMF(10, 3 * c(1, -1) / sqrt(2))