Consider the following PCA biplot:
library(mvtnorm)
set.seed(1)
x <- rmvnorm(2000, rep(0, 6), diag(c(5, rep(1,5))))
x <- scale(x, center=T, scale=F)
pc <- princomp(x)
biplot(pc)
There are a bunch of red arrows plotted, what do they mean? I knew that the first arrow labelled with "Var1" should be pointing the most varying direction of the data-set (if we think them as 2000 data points, each being a vector of size 6). I also read from somewhere, the most varying direction should be the direction of the 1st eigen vector.
However, reading into the code of biplot in R. The line about the arrows is:
if(var.axes)
arrows(0, 0, y[,1L] * 0.8, y[,2L] * 0.8, col = col[2L],
Where y
is the actually the loadings matrix, which is the eigenvector matrix. So it looks like the 1st arrow is actually pointing from (0, 0)
to (y[1, 1], y[1, 2])
. I understand that we are trying to plot a high dimensional arrow onto a 2D plane. That's why we are taking the 1st and 2nd element of the y[1, ]
vector. However what I don't understand is:
Shouldn't the 1st eigenvector direction be the vector denoted by y[, 1]
, instead of y[1, ]
? (Again, here y
is the eigenvector matrix, obtained by PCA or by eigendecomposition of t(x) %*% x
.) i.e. the eigenvectors should be column vectors, not those horizontal vectors.
Even though we are plotting them on 2D plane, we should draw the 1st direction to be from (0, 0)
pointing to (y[1, 1], y[2, 1])
?