Playground
§ Tool 05 — Applied Statistics

PCA Explorer

Interactive principal component analysis on a multivariate matrix. Generate synthetic sensor channels with a known intrinsic dimensionality, or upload a CSV, then center (optionally standardize) the columns, eigendecompose the covariance matrix with a cyclic Jacobi solver, and read off the scree plot, score scatter, loadings, and reconstruction error.

01

Data

Low-rank latent-factor model: k latent signals are mixed through a random loading matrix into p observed variables, with column strengths decaying geometrically (γ), then Gaussian noise is added. The data have a known intrinsic dimensionality, so the scree plot should show an elbow at k.
02

View settings

03

Variance per variable

Sample variance of each input variable (after the chosen preprocessing). Standardizing makes every variable contribute unit variance, which is the difference between covariance PCA and correlation PCA.
04

Scree plot

Percent of total variance explained by each principal component (bars) and the cumulative total (line). For synthetic data, the true rank k is marked; the elbow should fall there.
05

Score plot

Each observation projected onto the two selected components. With biplot arrows on, variable loadings are overlaid (scaled to the score cloud) to show which variables drive each direction.
06

Loadings

Signed loadings (eigenvector entries) of the selected component across the variables. Large-magnitude entries are the variables that define that component.
07

Reconstruction error

Relative Frobenius error of reconstructing the (preprocessed) data from the first k components: the empirical error from explicit reconstruction and the Eckart-Young closed form. They should coincide, which validates the decomposition.
08

Method

Given a data matrix X with n observations (rows) and p variables (columns), each column is centered by subtracting its mean. With standardizing on, each column is also divided by its standard deviation, which turns the covariance analysis into a correlation analysis (useful when variables have different units or scales).

Principal component analysis seeks orthogonal directions of maximum variance. They are the eigenvectors of the sample covariance matrix C = XcTXc / (n - 1), a p × p symmetric matrix. Here it is eigendecomposed by a cyclic Jacobi rotation. The eigenvalues λj are the variances captured by each component (sorted descending), the eigenvectors V are the loadings, and the scores are the projections T = Xc V.

The fraction of variance explained by component j is λj / Σ λ. Keeping the first k components and reconstructing, X̂ = T:,1..k V:,1..kT, gives the best rank-k approximation in the least-squares sense. By the Eckart-Young theorem the relative Frobenius error is exactly √(Σj > k λj / Σ λ), which the app plots alongside the empirically reconstructed error.

09

Related publications