| Title: | Fast Generation of von Mises-Fisher Distributed Pseudo-RandomVectors |
| Version: | 0.1.0 |
| Description: | Generates pseudo-random vectors that follow an arbitrary von Mises-Fisher distribution on a sphere. This method is fast and efficient when generating a large number of pseudo-random vectors. Functions to generate random variates and compute density for the distribution of an inner product between von Mises-Fisher random vector and its mean direction are also provided. Details are in Kang and Oh (2024) <doi:10.1007/s11222-024-10419-3>. |
| URL: | https://github.com/seungwoo-stat/rvMF |
| BugReports: | https://github.com/seungwoo-stat/rvMF/issues |
| License: | GPL (≥ 3) |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.1 |
| LinkingTo: | Rcpp |
| Imports: | Bessel (≥ 0.6-0), Rcpp (≥ 1.0.10), Rfast (≥ 2.0.6),scModels (≥ 1.0.4) |
| NeedsCompilation: | yes |
| Packaged: | 2024-03-27 01:46:11 UTC; admin |
| Author: | Seungwoo Kang |
| Maintainer: | Seungwoo Kang <kangsw0401@snu.ac.kr> |
| Repository: | CRAN |
| Date/Publication: | 2024-03-27 13:10:02 UTC |
rvMF: Fast Generation of von Mises-Fisher Distributed Pseudo-Random Vectors
Description
Generates pseudo-random vectors that follow an arbitrary von Mises-Fisher distribution on a sphere. This method is fast and efficient when generating a large number of pseudo-random vectors. Functions to generate random variates and compute density for the distribution of an inner product between von Mises-Fisher random vector and its mean direction are also provided. Details are in Kang and Oh (2024)doi:10.1007/s11222-024-10419-3.
Author(s)
Maintainer: Seungwoo Kangkangsw0401@snu.ac.kr (ORCID)
Authors:
Hee-Seok Ohheeseok@stats.snu.ac.kr
See Also
Useful links:
von Mises–Fisher Distributed Pseudo-Random Vector Generator
Description
rvMF() generates von Mises–Fisher distributed pseudo-random vectors,without resorting to the rejection-based sampling method proposed by Wood(1994). See Kang and Oh (2024) for details. This function partly uses thecode from the functionRfast::rvmf() and the article Marsaglia et al.(2004).
Usage
rvMF(n, mu, k)Arguments
n | number of pseudo-random vectors to generate. |
mu | mean direction. |
k | concentration parameter. |
Value
matrix where each row independently follows the specified vonMises-Fisher distribution. The number of columns equals the length ofmu,and the number of rows equalsn forrvMF.
References
S. Kang and H.-S. Oh. Novel sampling method for the von Mises–Fisherdistribution.Statistics and Computing, 34(3):106, 2024.
K. V. Mardia and P. E. Jupp.Directional Statistics, volume 494. JohnWiley & Sons, Chichester, 1999.
G. Marsaglia, W. W. Tsang, and J. Wang. Fast generation of discrete randomvariables.Journal of Statistical Software, 11(3):1–11, 2004.
M. Papadakis, M. Tsagris, M. Dimitriadis, S. Fafalios, I. Tsamardinos, M.Fasiolo, G. Borboudakis, J. Burkardt, C. Zou, K. Lakiotaki, and C.Chatzipantsiou.Rfast: A Collection of Efficient and Extremely Fast RFunctions, 2022.https://CRAN.R-project.org/package=Rfast. R packageversion 2.0.6.
A. T. Wood. Simulation of the von Mises Fisher distribution.Communicationsin Statistics– Simulation and Computation, 23(1):157–164, 1994.
See Also
rvMFangle(),dvMFangle(),Rfast::rvmf().
Examples
rvMF(10, c(0,0,1), 10)rvMF(10, c(1,1)/sqrt(2), 0)Inner Product of von Mises–Fisher Random Vector and Mean Direction
Description
These functions provide information about the distribution of an innerproduct between von Mises–Fisher random vector and its mean direction.Specifically, ifX follows a von Mises–Fisher distribution with meandirection\mu, the inner productX'\mu will be a random variablefollowing some distribution. See page 170 of Mardia and Jupp (1999).rvMFangle() generates random variates using the algorithm proposed in Kangand Oh (2024), anddvMFangle gives the density from this distribution. Thisfunction partly uses the code from the article Marsaglia et al. (2004).
Usage
rvMFangle(n, p, kappa)dvMFangle(r, p, kappa)Arguments
n | number of random vectors to generate. |
p | dimension of the sphere. i.e.,Sp-1, |
kappa | concentration parameter. |
r | vector of quantiles. -1 ≤ |
Value
rvMFangle()returns a vector whose components independently follow theaforementioned distribution. The length of the result is determined bynforrvMFangle().dvMFangle()returns a vector of density function value. The length of theresult is determined by the length ofrfordvMFangle().
References
S. Kang and H.-S. Oh. Novel sampling method for the von Mises–Fisherdistribution.Statistics and Computing, 34(3):106, 2024.
K. V. Mardia and P. E. Jupp.Directional Statistics, volume 494. John Wiley& Sons, Chichester, 1999.
G. Marsaglia, W. W. Tsang, and J. Wang. Fast generation of discrete randomvariables.Journal of Statistical Software, 11(3):1–11, 2004.
See Also
rvMF() wrapper ofrvMFangle().
Examples
rvMFangle(10, 2, 10)rvMFangle(10, 3, 0.1)dvMFangle(seq(-1,1,by=0.01), 2, 10)dvMFangle(seq(0,1,by=0.01), 3, 0.1)