Functions > Vector and Matrix > Array Characteristics > Example: Covariance and Principal Component Analysis
  
Example: Covariance and Principal Component Analysis
Calculate the covariance of a data set, and use the eigenvals and eigenvec functions to perform principal component analysis.
1. Define the following matrix D.
Click to copy this expression
Each row of D represents one observation, each column a measured characteristic.
2. Calculate the covariance matrix of the sample.
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
3. Compute and sort the eigenvalues.
Click to copy this expression
Click to copy this expression
4. Compute the transform matrix.
Click to copy this expression
Click to copy this expression
Click to copy this expression
5. Transform the original data.
Click to copy this expression
6. Calculate the covariance matrix of the transformed data.
Click to copy this expression
Click to copy this expression
Click to copy this expression
Click to copy this expression
The principal components of the data are the diagonal elements of matrix S2.