orth: Orthogonalize a matrix

View source: R/OmicsPLS.R

orthR Documentation

Orthogonalize a matrix

Description

Orthogonalize a matrix

Usage

orth(X, X_true = NULL, type = c("QR", "SVD"))

Arguments

X

Numeric vector or matrix.

X_true

(optional) A 'true' matrix/vector. Used to correct the sign of the orthonormalized X if QR is used. Only the first column is corrected.

type

A character or numeric. Should be one of "QR" or "SVD".

Details

Choosing type='QR' uses a QR decomposition of X to produce orthonormal columns. For type=='SVD' it uses an SVD decomposition. The columns are corrected for sign.

Value

An orthogonalized representation of X

Examples

orth(c(3,4))
round(crossprod(orth(matrix(rnorm(500),100,5))),4)
orth(matrix(1:9,3,3),type='QR')[,1] - orth(1:3); orth(matrix(1:9,3,3),type='SVD')[,1] - orth(1:3);

selbouhaddani/OmicsPLS documentation built on Aug. 25, 2022, 9:52 p.m.