This post continues with the understanding of calculation of the Principals Components with R, I have written some posts before you can read before to continue:
Using R: NIPALS Spectra Reconstruction
Spectra Reconstruction (Adding the Mean Spectra to the Centered ones)
Once we have the "T" (scores matrix), we can check the correlation of the scores (of a certain principal component) with the different constituents. In this case we are going to check the correlation of the PC1, PC2 and PC3 with the constituent Fat.
I have the values for fat in my training data set, the same from which I had developped the PCA , so now it is easy:
cor(T1_nipals,sflw.msc3.tra$G00rmn) #-0.08544355
cor(T2_nipals,sflw.msc3.tra$G00rmn) #-0.4114215
cor(T3_nipals,sflw.msc3.tra$G00rmn) # 0.8096445
We can see than in the first one there are not correlation at all, the second one has a negative correlation, but the third one has a high positive correlation.
cor(T2_nipals,sflw.msc3.tra$G00rmn) #-0.4114215
cor(T3_nipals,sflw.msc3.tra$G00rmn) # 0.8096445
We can see than in the first one there are not correlation at all, the second one has a negative correlation, but the third one has a high positive correlation.
If we are use to the patterns of the fat bands in the NIR region, maybe looking to the "P" loading matrix, we can confirm this.
All the loadings have peaks related to fat, because this product has a high fat content (sunflower seed), but the first one seems to have a high correlation with moisture, in the second one the peaks are negative, and in the third positive. Remember when looking to these plots that we are working with centered data.
All the loadings have peaks related to fat, because this product has a high fat content (sunflower seed), but the first one seems to have a high correlation with moisture, in the second one the peaks are negative, and in the third positive. Remember when looking to these plots that we are working with centered data.
#Main peaks in PC1:negative: 1455.7 1937.4 positive:2307.2 2347.5
#Main peaks in PC2:negative: 1707.0, 1760.4, 1211.0, 1388.0
#Main peaks in PC3:positive:1725.2, 1760.4 ,1211.0, 1924.4 1391.9
PC1 Loading PC2 Loading PC3 Loading
|
No hay comentarios:
Publicar un comentario