R/rkent.R

Defines functions rkent

Documented in rkent

################################
#### Simulating from a Kent distribution
#### Tsagris Michail 04/2016
#### mtsagris@yahoo.gr
#### References: A new method to simulate the Bingham and related distributions in
#### directional data analysis with applications
#### Kent J.T., Ganeiber A.M. and Mardia K.V. (2013)
#### http://arxiv.org/pdf/1310.8110v1.pdf
################################
rkent <- function(n, k, m, b) {
  ## n is the required sample size
  ## k is the concentration parameter, the Fisher part
  ## m is the mean vector, the Fisher part
  ## b is the ovalness parameter
  m0 <- rnorm(3)
  m0 <- m0 / sqrt( sum(m0^2) )
  m <- m / sqrt( sum(m^2) )
  a <- rotation(m0, m)
  A <- diag( c(-b, 0, b) )
  x <- Directional::rfb(n, k, m0, A)  ## simulated values with mean direction equal to m
  tcrossprod(x, a)  ## simulated values with mean direction equal to m
}

Try the Directional package in your browser

Any scripts or data that you put into this service are public.

Directional documentation built on Oct. 30, 2024, 9:15 a.m.