Function Reference: pcacov

statistics: coeff = pcacov (K)
statistics: [coeff, latent] = pcacov (K)
statistics: [coeff, latent, explained] = pcacov (K)

Perform principal component analysis on covariance matrix

coeff = pcacov (K) performs principal component analysis on the square covariance matrix K and returns the principal component coefficients, also known as loadings. The columns are in order of decreasing component variance.

[coeff, latent] = pcacov (K) also returns a vector with the principal component variances, i.e. the eigenvalues of K. latent has a length of size (coeff, 1).

[coeff, latent, explained] = pcacov (K) also returns a vector with the percentage of the total variance explained by each principal component. explained has the same size as latent. The entries in explained range from 0 (none of the variance is explained) to 100 (all of the variance is explained).

pcacov does not standardize K to have unit variances. In order to perform principal component analysis on standardized variables, use the correlation matrix R = K ./ (SD * SD'), where SD = sqrt (diag (K)), in place of K. To perform principal component analysis directly on the data matrix, use pca.

References

  1. Jolliffe, I. T., Principal Component Analysis, 2nd Edition, Springer, 2002

See also: bartlett, factoran, pcares, pca

Source Code: pcacov

Example: 1

 

 x = [ 7    26     6    60;
       1    29    15    52;
      11    56     8    20;
      11    31     8    47;
       7    52     6    33;
      11    55     9    22;
       3    71    17     6;
       1    31    22    44;
       2    54    18    22;
      21    47     4    26;
       1    40    23    34;
      11    66     9    12;
      10    68     8    12
     ];
 Kxx = cov (x);
 [coeff, latent, explained] = pcacov (Kxx)

coeff =

  -0.067800  -0.646018   0.567315   0.506180
  -0.678516  -0.019993  -0.543969   0.493268
   0.029021   0.755310   0.403553   0.515567
   0.730874  -0.108480  -0.468398   0.484416

latent =

   517.7969
    67.4964
    12.4054
     0.2372

explained =

   8.6597e+01
   1.1288e+01
   2.0747e+00
   3.9662e-02