
A command to calculate the angle between two planes. Each plane is spanned by the first two eigenvectors from the corresponding PCA.
The algorithm is described in section 12.4.3 of Golub & van Loan (1996):
First we form the projection of one set of eigenvectors on the other set. This results in a 2×2 matrix C:
C = E_{1}′ E_{2}, 
where E_{1} and E_{2} are 2×dimension and dimension×2 matrices that contain the first two eigenvectors of the PCA's, respectively.
Next, we compute the singular value decomposition of C:
C = U Σ V′ 
Now the cosine of the angle between the two planes is given by σ_{2} and the angle in degrees is therefore:
arccos (σ_{2})·180/π 
© djmw, October 28, 2004