rorth {ICtest} | R Documentation |
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. |
Details
The function fills a k
xk
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).
Value
An orthogonal k
times k
matrix
Author(s)
Klaus Nordhausen
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
Orth <- rorth(4)
crossprod(Orth)
tcrossprod(Orth)