Principal Component Analysis is essentially a change of basis for your dataset. Say your dataset has N variables and P samples. Each sample of your dataset has a natural representation as a point in a space of N dimensions, with its values being the coordinates in the basis {(1, 0...0), (0, 1, 0...0), ..., (0...0, 1)}.
PCA finds a new basis using linear combinations of this basis. This new basis is made of the principal components. There are thus N principal components.
PCA uses two steps to find these linear combinations:
1. Calculate the covariance matrix K for the variables. For each pair of variables, K stores their joint variability over the samples or covariance:
2. Calculate the eigenvectors (V1, V2, ... VN) and eigenvalues (a1, a2,... aN) of the covariance matrix by solving:
K x V = a V
The eigenvectors are the principal components and form the new basis (once ordered by decreasing eigenvalue). These vectors are orthogonal to each others.
The coordinates of the eigenvectors in the old basis are what the Loadings sync table returns. They form the change-of-basis matrix.
The coordinates of the samples in the new basis are what the Principal Components sync table returns.
The last row of the Loadings sync table is the percentage explained, defined as
{a1/(a1+...+aN), (a1+a2)/(a1+...+aN), ...., 1}
Practice
Below are the sync tables we used for our examples. Coda allows only one instance of each table per doc, so both Principal Components and Loadings contain all our datasets. They are separated using the Group column, see