PCA 3D Visualizer

Generate correlated data, compute principal components, and project to 2D.

Covariance and projection in the saved 3D PCA lab

Read the explanation

The saved generator creates three hundred points from independent uniforms between minus one and one. It sets x to five times the first draw, y to five times a mixture of the first and second draws, and z to five times a scale times the third draw. The correlation slider is the mixture coefficient, not the exact Pearson correlation. At coefficient point eight, population covariance of x and y is six point six six seven, with variances eight point three three three and five point six six seven. Their population correlation is about point nine seven zero, not point eight. Finite samples fluctuate around these analytic population quantities. The source subtracts the sample centroid, computes X transpose times X divided by two hundred ninety-nine, then sorts covariance eigenvalues from largest to smallest. The arrows are the corresponding orthogonal principal directions. As an illustrative covariance with variances nine, four and one along those directions, PC one carries nine, PC two four and PC three one. The common-scale bars show those exact example values. These are an algorithm example, not measured eigenvalues of a newly random cloud. The source discards the lowest-variance direction when projecting into a plane. For each point, the source subtracts its signed projection onto PC three, measured from the centroid. If the centroid is zero and PC three is the z axis, an illustrative point three, two, one flattens to three, two, zero. At the projection slider halfway, it lies at three, two, one half. These bars use four hundred pixels per z-coordinate unit and show one, one half and zero. General clouds use their actual eigenvector rather than this axis example. Generate creates a new random dataset and clears the old PCA; Reset View resets the camera, while Export PNG captures an image, not the raw point table.

Super generates helpful tools and automates fact-checking across the internet proactively. If you enjoyed this tool, build your own with Super and share it with a friend.