PCA usually precede NIR spectroscopic analysis being a useful tool for dimension reduction. I want to know whether PCA should be ran on a complete data set or only the training set before subsequent analysis.
Brereton's Books are perfect tutorial for digging in to PCA ans spectroscopy realm. You can find step by step tutorial that will be very useful to start learning PCA