Random.Start: Generate a Random Orthogonal Rotation

View source: R/RandomStart.R

Random.StartR Documentation

Generate a Random Orthogonal Rotation

Description

Random orthogonal rotation to use as Tmat matrix to start GPFRSorth, GPFRSoblq, GPForth, or GPFoblq.

Usage

    Random.Start(k)
    

Arguments

k

An integer indicating the dimension of the square matrix.

Details

The random start function produces an orthogonal matrix with columns of length one based on the QR decompostion.

Value

An orthogonal matrix.

Author(s)

Coen A. Bernaards and Robert I. Jennrich with some R modifications by Paul Gilbert

See Also

GPFRSorth, GPFRSoblq, GPForth, GPFoblq, oblimin

Examples

	Random.Start <- function(k,orthogonal=TRUE){
	   # routine for generating orthogonal or oblique random matrix
	   mat <- matrix(rnorm(k*k),k)
	   if (orthogonal){
 	      ans <- qr.Q(qr(mat))
 	   }
 	   else{
	      ans <- mat %*% diag(1/sqrt(diag(crossprod(mat))))
 	   }
	   ans
	}
	
	data("Thurstone", package="GPArotation")
	simplimax(box26,Tmat = Random.Start(3, TRUE))
	simplimax(box26,Tmat = Random.Start(3, FALSE))

	# covariance matrix is Phi = t(Th) %*% Th
	rms <- Random.Start(3, FALSE)
	t(rms) %*% rms # covariance matrix because oblique rms
	rms <- Random.Start(3, TRUE)
	t(rms) %*% rms # identity matrix because orthogonal rms
	
   

GPArotation documentation built on Nov. 16, 2023, 5:09 p.m.