2
$\begingroup$

My data set is a 60x10 matrix. I performed principal component analysis of this matrix with matlab using the princomp(AdjustedData) after I adjusting my original data set by subtracting the mean of each column. Because I was hoping to obtain a data set described by the top five principal components, I selected the top five vectors in the COEFF output as my feature vectors. I firstly multiply the row feature vectors (vector on each row, 5x10) by my row adjusted data matrix (transposed adjusted data matrix with different dimensions on each row, 10x60) to obtain the so called final data.

           FinalData (5x60)=Row feature vector(5x10) * row AdjustedData(10x60)

Then, I multiply the transposed row feature vector(10x5) by the FinalData(5x60) to get a matrix as the same dimensions as my transposed original data set.

TransOriginalAdjustedData(10x60)=TransposedRowFeatureVector(10x5)*FinalData(5x60) Finally, I transpose the output matrix and add the mean of each column back to retrieve the final original matrix (PCA data, a data set I thought described by only 5 principal components) that I want to compare with my original data set.

    PCA data=OriginalAdjustedData(60x10)+ original column mean

I sum up the square difference between the data points of my original data set and the PCA data set, and take a square root of the sum. The result was about 0.022.

However, if I transpose my original data matrix, 10x60 instead of 60x10, and performed the same procedures, the result was only 0.015. I know the dimension of the matrix is changed when performing PCA if I transpose the original matrix, but I cannot figure out what is causing the large difference between the two. The variables in my data set were not defined so I thought either way should work about the same.

My procedures are based on this PCA tutorial: http://www.cs.otago.ac.nz/cosc453/student_tutorials/principal_components.pdf

Could anyone help me with this? Thank you very much.

$\endgroup$
  • 1
    $\begingroup$ The short answer is yes. At some point, you'll be taking the SVD of a matrix as part of PCA. If you transpose that matrix, you'll also be swapping the matrices of left and right singular vectors, which affects the result of the PCA. $\endgroup$ – Geoff Oxberry Sep 15 '14 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.