Learn R Programming

rstiefel (version 1.0.1)

rbmf.vector.gibbs: Gibbs Sampling for the Vector-variate Bingham-von Mises-Fisher Distribution

Description

Simulate a random normal vector from the Bingham-von Mises-Fisher distribution using Gibbs sampling.

Usage

rbmf.vector.gibbs(A, c, x)

Arguments

A

a symmetric matrix.

c

a vector with the same length as x.

x

the current value of the random normal vector.

Value

a new value of the vector x obtained by Gibbs sampling.

References

Hoff(2009)

Examples

Run this code
# NOT RUN {
## The function is currently defined as
function (A, c, x) 
{
    evdA <- eigen(A)
    E <- evdA$vec
    l <- evdA$val
    y <- t(E) %*% x
    d <- t(E) %*% c
    x <- E %*% ry_bmf(y, l, d)
    x/sqrt(sum(x^2))
  }

# }

Run the code above in your browser using DataLab