BSSprep {BSSprep} | R Documentation |
A function for data whitening.
BSSprep(X)
X |
A numeric matrix. Missing values are not allowed. |
A p
-variate {\bf Y}
with T
observations is whitened, i.e. {\bf Y}={\bf S}^{-1/2}({\bf X}_t - \frac{1}{T}\sum_{t=1}^T {\bf X}_{t})
, for t = 1, \ldots, T
,
where {\bf S}
is the sample covariance matrix of {\bf X}
.
This is often need as a preprocessing step like in almost all blind source separation (BSS) methods. The function is implemented using C++ and returns the whitened data matrix as well as the ingredients to back transform.
A list containing the following components:
Y |
The whitened data matrix. |
X.C |
The mean-centered data matrix. |
COV.sqrt.i |
The inverse square root of the covariance matrix of X. |
MEAN |
Mean vector of X. |
Markus Matilainen, Klaus Nordhausen
n <- 100
X <- matrix(rnorm(10*n) - 1, nrow = n, ncol = 10)
res1 <- BSSprep(X)
res1$Y # The whitened matrix
colMeans(res1$Y) # should be close to zero
cov(res1$Y) # should be close to the identity matrix
res1$MEAN # Should hover around -1 for all 10 columns