# rmf.matrix.gibbs: Gibbs Sampling for the Matrix-variate von Mises-Fisher... In rstiefel: Random Orthonormal Matrix Generation and Optimization on the Stiefel Manifold

## Description

Simulate a random orthonormal matrix from the matrix von Mises-Fisher distribution using Gibbs sampling.

## Usage

 `1` ```rmf.matrix.gibbs(M, X, rscol = NULL) ```

## Arguments

 `M` a matrix. `X` the current value of the random orthonormal matrix. `rscol` the number of columns to update simultaneously.

## Value

a new value of the matrix `X` obtained by Gibbs sampling.

## Note

This provides one Gibbs scan. The function should be used iteratively.

Peter Hoff

Hoff(2009)

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25``` ```Z<-matrix(rnorm(10*5),10,5) U<-rmf.matrix(Z) U<-rmf.matrix.gibbs(Z,U) ## The function is currently defined as function (M, X, rscol = NULL) { if (is.null(rscol)) { rscol <- max(2, min(round(log(dim(M)[1])), dim(M)[2])) } sM <- svd(M) H <- sM\$u %*% diag(sM\$d) Y <- X %*% sM\$v m <- dim(H)[1] R <- dim(H)[2] for (iter in 1:round(R/rscol)) { r <- sample(seq(1, R, length = R), rscol) N <- NullC(Y[, -r]) y <- rmf.matrix(t(N) %*% H[, r]) Y[, r] <- N %*% y } Y %*% t(sM\$v) } ```

rstiefel documentation built on June 12, 2018, 5:19 p.m.