orth: Orthogonalize a matrix

Description Usage Arguments Details Value Examples

View source: R/OmicsPLS.R

Description

Orthogonalize a matrix

Usage

1
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

1
2
3
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);

Example output

Attaching package:OmicsPLSThe following object is masked frompackage:stats:

    loadings

     [,1]
[1,]  0.6
[2,]  0.8
     [,1] [,2] [,3] [,4] [,5]
[1,]    1    0    0    0    0
[2,]    0    1    0    0    0
[3,]    0    0    1    0    0
[4,]    0    0    0    1    0
[5,]    0    0    0    0    1
     [,1]
[1,]    0
[2,]    0
[3,]    0
            [,1]
[1,] -0.68664743
[2,] -0.81204126
[3,]  0.06256491

OmicsPLS documentation built on May 19, 2021, 5:08 p.m.