| vmf | R Documentation |
Density, distribution function, and random generation for the von Mises-Fisher distribution.
dvmf(x, mu, kappa, log = FALSE)
rvmf(n, mu, kappa)
x |
unit vector or matrix (with each row being a unit vector) of evaluation points |
mu |
unit mean vector |
kappa |
non-negative numeric value for the concentration parameter of the distribution. |
log |
logical; if |
n |
number of random values to return. |
This implementation of dvmf allows for automatic differentiation with RTMB. rvmf is a reparameterised import from movMF::rmovMF.
dvmf gives the density and rvm generates random deviates.
set.seed(123)
# single parameter set
mu <- rep(1, 3) / sqrt(3)
kappa <- 4
x <- rvmf(1, mu, kappa)
d <- dvmf(x, mu, kappa)
# vectorised over parameters
mu <- matrix(mu, nrow = 1)
mu <- mu[rep(1,10), ]
kappa <- rep(kappa, 10)
x <- rvmf(10, mu, kappa)
d <- dvmf(x, mu, kappa)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.