Nicktz
6/6/2016 - 9:00 AM

Orthogonalizing (orthonormalizing) columns r

library(far)

data <- 
  data.frame(x = rnorm(30, 0, 1.5), 
             y = rnorm(30, 0, 1.5),
             z = rnorm(30, 0, 1.5))

y <- 
  orthonormalization(data,basis=FALSE, norm=TRUE)
# basis = TRUE squares columns.
crossprod(y) # Check that diagonals are 1 and off-diagonals close to zero
cor(y[,1], y[,3])