Code to check the variance retained by PCA