Skip to content
Prev 4822 / 7420 Next

Minimum Number of Observations for pcaCoDa?

Rich,

It seems that the robust covariance matrix (? I assume it is that) is not non-negative definite... 

Function robCompositios::pcaCoDa seems to use function princomp of base R (or its stats package) as the engine to get the principal components. If that function is used for raw data, it stops with error message ("'princomp' can only be used with more units than variables") if the number of columns is larger than the number of rows. However, it seems that it may still be able to handle these cases if you use covariance matrix, and the last (ncol > nrow) eigenvalues will be numerically zero -- that is: the covariance matrix is non-negative definite. Normal covariance matrices normally satisfy this (with provision of numerical precision), but it seems that the robust covariance matrix does not.

Actually, the warning is very clear and says: "n < 2 * p, i.e., possibly too small sample size". The condition I put above was only that n < p, but this seems to require that the number of rows is two times higher than the number of columns. Because this was not case, the warning came true and you got an error. So yes, you need more data if you wish to use this tool. 

Cheers, Jari Oksanen