I am performing a PCA analysis in Matlab on a $110\times 7$ dataset using some custom code. I am checking my code against Matlab's princomp and my eigenvectors are the same except that the 3rd and the 7th column are of the opposite sign.
What does that mean? And why does this happen?
My code is:
mu = mean(data);
data = bsxfun(@minus,data,mu);
sigma = transpose(data) * data / size(data, 1);
[eigenvectors, eigenvalues]=eig(sigma);
eigenvalues=diag(eigenvalues)
[ev index]=sort(eigenvalues,'descend');
eigenvectors=eigenvectors(:,index);
pc = data*eigenvectors';