I came to know about the following steps in doing PCA:
- Given some data matrix X,subtract the mean from each dimension.
- Calculate the sample covariance matrix.
- Calculate the eigen vectors and values of the covariance.
- Keep the vectors with the largest values.(W)
- Derive the reduced data matrix Z = XW.
Can somebody please explain these points with a practical example in R?