The R function corrgram
(in the corrgram
package) offers several options for re-ordering the correlation matrix. One of them is a "PCA-based re-ordering" with the following source code:
x.eigen <- eigen(cmat)$vectors[, 1:2]
e1 <- x.eigen[, 1]
e2 <- x.eigen[, 2]
alpha <- ifelse(e1 > 0, atan(e2/e1), atan(e2/e1) + pi)
ord <- order(alpha)
where cmat
is a correlation matrix $R$ and ord
is used to re-order the variables.
That is, each variable $x_k$ gets assigned an $\alpha_k$ where $$ \alpha_k = \cases{\arctan \frac{e_{1,k}}{e_{2,k}}, \quad e_{1,k} > 0 \\ \arctan \frac{e_{1,k}}{e_{2,k}} + \pi, \quad e_{1,k} \leq 0} $$ and $e_1 = \left(e_{1,k}\right)_{k=1}^K$ and $e_2 = \left(e_{2,k}\right)_{k=1}^K$ are the first two eigenvectors of $R$, which is $K \times K$. Then the variables are sorted in order of largest $\alpha_k$ to smallest.
There's no reference for this or additional detail in the help file. What does this reordering accomplish and how should it be interpreted?