Can PRINCOMP be used on incomplete or missing data in MATLAB 7.8 (R2009a)?
2 views (last 30 days)
Show older comments
I wish to do principal component analysis on a dataset containing missing data. I have used NaNs as placeholders. When I pass the data into PRINCOMP, I obtain the following error:
??? Error using ==> svd
Input to SVD must not contain NaN or Inf.
Error in ==> princomp at 69
[U,sigma,coeff] = svd(x0,econFlag); % put in 1/sqrt(n-1) later
Accepted Answer
MathWorks Support Team
on 27 Jun 2009
The algorithm underlying PRINCOMP that determines these coefficients does SVD on the input matrix. If the input matrix contains NaNs or Infs as placeholders for the empty elements, SVD can not be done. Therefore, PRINCOMP can only be used with complete data.
As a workaround, you could use the ISNAN and ISINF functions to identify and remove NaN or INF elements if it makes sense for your situation.
Computing the principal components for incomplete or missing data is an area of active research in the Statistics community. These methods often suggest ways for estimating values for the missing data and then doing PCA. This may or may not be an option, depending on whether you have a reliable way of extrapolating values for timestamps where no data was observed.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!