A short overview of implementing principal component analysis from first principles in R.

Principal component analysis (PCA) is the orthogonal linear transformation of the set of original variables. PCA is commonly used for dimensionality reduction since one can transform a dataset with p random variables to a dataset with k<p variables that still contains most of the information of the original dataset.

There is a package for everything even for something as simple as PCA. Despite this, it is often helpful to do things from first principles. This assists in understanding the method and also provides a deeper intuition into what is being done. Although there is a package for PCA I will…