Learn R Programming

ICtest (version 0.3-5)

rorth: Random Orthogonal Matrix Creation Uniform WRT the Haar Measure.

Description

A function to create a random orthogonal matrix uniformly distributed with respect to the Haar measure.

Usage

rorth(k)

Arguments

k

the desired numer of columns (=rows) of the orthogonal matrix.

Value

An orthogonal k times k matrix

Details

The function fills a kxk matrix with N(0,1) random variables and perfroms then a QR decompoistion using qr. If the diagonal elements of R are all positive the resulting orthogonal matrix Q is uniform distributed wrt to the Haar measure. Note that the function currently does not check if all diagonal measurements are indeed positive (however this will happen with probability 1 in theory).

References

Stewart, G.W. (1980), The efficient generation of random orthogonal matrices with an application to condition estimators, SIAM Journal on Numerical Analysis, 17, 403--409. <doi:10.1137/0717034>.

Examples

Run this code
# NOT RUN {
Orth <- rorth(4)

crossprod(Orth)
tcrossprod(Orth)
# }

Run the code above in your browser using DataLab