Last data update: 2014.03.03

R: Random values simulation from a mixture of von Mises-Fisher...
rmixvmfR Documentation

Random values simulation from a mixture of von Mises-Fisher distributions

Description

The function simulates random values simulation from a given mixture of von Mises-Fisher distributions.

Usage

rmixvmf(n, prob, mu, k)

Arguments

n

The sample size.

prob

This is avector with the mixing probability of each group.

mu

A matrix with the mean direction of each group.

k

A vector with the concentration parameter of each group.

Details

The function simulates random values simulation from a given mixture of von Mises-Fisher distributions using the rvmf function.

Value

A list including:

id

An indicator of the group of each simulated vector.

x

A matrix with the simulated data.

Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris <mtsagris@yahoo.gr> and Giorgos Athineou <athineou@csd.uoc.gr>

References

Kurt Hornik and Bettina Grun (2014). movMF: An R Package for Fitting Mixtures of von Mises-Fisher Distributions http://cran.r-project.org/web/packages/movMF/vignettes/movMF.pdf

See Also

mix.vmf, rvmf, rvmf, bic.mixvmf

Examples

k <- runif(4, 4, 20)
prob <- c(0.2, 0.4, 0.3, 0.1)
mu <- matrix(rnorm(16), ncol = 4)
mu <- mu / sqrt( rowSums(mu^2) )
x <- rmixvmf(200, prob, mu, k)$x
bic.mixvmf(x, 5)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Directional)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Directional/rmixvmf.Rd_%03d_medium.png", width=480, height=480)
> ### Name: rmixvmf
> ### Title: Random values simulation from a mixture of von Mises-Fisher
> ###   distributions
> ### Aliases: rmixvmf
> ### Keywords: Random values simulation Mixtures of von Mises-Fisher
> ###   distributions
> 
> ### ** Examples
> 
> k <- runif(4, 4, 20)
> prob <- c(0.2, 0.4, 0.3, 0.1)
> mu <- matrix(rnorm(16), ncol = 4)
> mu <- mu / sqrt( rowSums(mu^2) )
> x <- rmixvmf(200, prob, mu, k)$x
> bic.mixvmf(x, 5)
$bic
       1        2        3        4        5 
1100.997 1023.198 1011.767 1009.276 1028.692 

$runtime
   user  system elapsed 
  0.204   0.004   0.208 

> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>