PCA is based on SVD or EIG, and these functions do not support NaN inputs. This is because there is no simple, unique way to ignore NaN values when computing these function.
Some ideas:
- If each row or column of your input matrix represents an independent measurement, remove all rows (or columns) that contain any NaN values.
- Set all NaN values to zero, or to the mean (or median) of all values in the matrix. Possibly, it would be better to set them to the mean of the row or column that they are in, if these each represent one type of measurement.
- Take a look at the fillmissing function, perhaps one of the options there would be suitable for replacing the NaN values in your input data.
