gsorth: Gram-Schmidt Orthogonalization of a Matrix

Description Usage Arguments Details Value Examples

View source: R/gsorth.R

Description

Calculates a matrix with uncorrelated columns using the Gram-Schmidt process

Usage

1
gsorth(y, order, recenter = TRUE, rescale = TRUE, adjnames = TRUE)

Arguments

y

a numeric matrix or data frame

order

if specified, a permutation of the column indices of y

recenter

logical; if TRUE, the result has same means as the original y, else means = 0 for cols 2:p

rescale

logical; if TRUE, the result has same sd as original, else, sd = residual sd

adjnames

logical; if TRUE, colnames are adjusted to Y1, Y2.1, Y3.12, ...

Details

This function, originally from the heplots package has now been deprecated in matlib. Use GramSchmidt instead.

Value

a matrix/data frame with uncorrelated columns

Examples

1
2
3
4
5
6
7
8
## Not run: 
 set.seed(1234)
 A <- matrix(c(1:60 + rnorm(60)), 20, 3)
 cor(A)
 G <- gsorth(A)
 zapsmall(cor(G))
 
## End(Not run)

Example output

Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 
          [,1]      [,2]      [,3]
[1,] 1.0000000 0.9741292 0.9659882
[2,] 0.9741292 1.0000000 0.9747492
[3,] 0.9659882 0.9747492 1.0000000
        col1 col2.1 col3.12
col1       1      0       0
col2.1     0      1       0
col3.12    0      0       1

matlib documentation built on April 4, 2018, 5:03 p.m.