Mathematical Derivation: ZCA Whitening Implementation
Published:
This document details the ZCA (Zero-phase Component Analysis) Whitening method implemented in ZCA.R. ZCA is unique because it decorrelates the data while keeping the transformed signals as close as possible to the original signals in the least-squares sense.
1. Core Concept
Unlike PCA whitening, which rotates the data to the principal component axes, ZCA whitening rotates the data back to the original axes after scaling. This preserves the spatial arrangement of EEG channels, making the whitened data topographically interpretable.
2. Mathematical Formulation
Step 1: Eigendecomposition
As with PCA, we start with the eigendecomposition of the covariance matrix $\Sigma$:
\[\Sigma = U \Lambda U^\top\]Step 2: Constructing the Whitening Matrix
The ZCA whitening matrix $W_{\text{ZCA}}$ is defined as:
\[W_{\text{ZCA}} = U \Lambda^{-1/2} U^\top\]Notice that $W_{\text{ZCA}}$ is symmetric. It is essentially the inverse square root of the covariance matrix, $\Sigma^{-1/2}$.
R Code Correspondence: ```r
U * diag(1/sqrt(lambda)) * U^T
U_diag <- U %% diag(1 / sqrt(lambda)) %% t(U) W <- U_diag