my_Whiten: Helper Function to Whiten Datasets

Description Usage Arguments Value Author(s) Examples

View source: R/my_Whiten.R

Description

This function takes in a single dataset X with $$X^2$$ and outputs blah

Usage

1

Arguments

x

A real-valued matrix with observations.. and variables ...

Value

v

The whitening matrix

z

The dataset in vars and observations, whitened

Author(s)

Hans-Peter Bakker

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (x)
{
    x_centered <- apply(x, 2, function(x) {
        x - mean(x)
    })
    cvx <- cov(x_centered)
    eigens <- eigen(cvx)
    E <- eigens$vectors
    D_invsqrt <- diag(1/sqrt(eigens$values))
    myBasicWhiteningMatrix <- E %*% D_invsqrt %*% t(E)
    z <- myBasicWhiteningMatrix %*% t(x_centered)
    list(v = myBasicWhiteningMatrix, z = z)
  }

hanspeter6/icaPlay documentation built on May 2, 2020, 2:34 p.m.