the coeff of pca in matlab is not a p*p matrix -
my data matrix x
4999*37152
. use command in matlab: [coeff, score, latent, tsquared1, explained1] = pca(x);
the output: coeff
37152*4998
, score
4999*4998
, latent
4998*1
. according http://www.mathworks.com/help/stats/pca.html, coeff should p*p. wrong code ?
as matlab documentation says, "rows of x correspond observations , columns correspond variables". feeding in matrix 4999 observations 37152 observations. geometrically, have 4999 points in 37152-dimensional space. these points contained in 4998-dimensional affine subspace, matlab gets 4998 directions there (each expressed vector 37152 components).
for more, see statistics site:
- why there n-1 principal components n data points if number of dimensions larger n?
- pca when dimensionality greater number of samples
the matlab documentation written under assumption have @ least many observations variables, how people use pca.
of course, it's possible data has 37152 observations 4999 variables, in case need transpose x.
Comments
Post a Comment