I have a 73 by 426 matrix, where 73 is the number of my observations, and 426 is the number of my features/dimensions. When I perform the PCA, I expect to get a 73 by 426 score matrix; instead, I get a 73 by 72 matrix. I assume this is because I have more dimensions than observations. Is there a way to overcome this problem?

Here is my code in Matlab:

[coeff,score,~,~,explained] = pca(class1Sgn);

marked as duplicate by gung, kjetil b halvorsen, usεr11852, SmallChess, JohnK Apr 7 '17 at 7:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Partial least squares is a kind of predictive PCA useful in your specific instance with more features than data. $\endgroup$ – Mike Hunter Apr 6 '17 at 16:29
  • $\begingroup$ Is this a pca function you wrote? Some environment details would be helpful. $\endgroup$ – Matt L. Apr 6 '17 at 16:31
  • $\begingroup$ no this is the function provided by MATLAB $\endgroup$ – xava Apr 6 '17 at 16:47
  • 1
    $\begingroup$ why do you expect 73 by 426 score matrix? $\endgroup$ – Aksakal Apr 6 '17 at 17:15
  • 2
    $\begingroup$ I think you will find the information you need in the linked thread. Please read it. If it isn't what you want / you still have a question afterwards, come back here & edit your question to state what you learned & what you still need to know. Then we can provide the information you need without just duplicating material elsewhere that already didn't help you. $\endgroup$ – gung Apr 6 '17 at 20:08

Took some digging, but if you look at the MATLAB documentation it uses the SVD function to accomplish this task. If you look at the SVD documentation it states:


[m-by-n matrix A]

m > n — Only the first n columns of U are computed, and S is n-by-n.

m = n — svd(A,'econ') is equivalent to svd(A).

m < n — Only the first m columns of V are computed, and S is m-by-m.

And then if you take what @user3348782 said you lose 1 degree of freedom when you do PCA and the result is a m-by-(m-1) matrix.


Recall that principal components are, by construction, orthogonal. Your original data has a rank of 73 at most, so you cannot derive more than 73 principal components from it. In fact you will lose a degree of freedom yielding 72 PC's.

But what in the world do you plan on doing with 72 principal components?

I can't suggest whether to go this route without knowing your use case, but using a handful of principal components (the first 5-10 for instance) out of your 72 is done in some cases. Things can go wrong in PCA, even for the first few PC's, if your eigenvalues/scree plot do not show those first PC's having much larger eigenvalues than the others.

There is no way for PCA to give you a 73 by 436 score matrix. You could force factor analysis to do it, but I don't think you would yield anything useful. If going the PCA route, you could bootstrap several estimates to test the stability of your first few principal components.




Not the answer you're looking for? Browse other questions tagged or ask your own question.