27 mar 2014

NIPALS: X residuals


This diagram shows the spectra reconstruction. We have the T matrix which showsunder the plots the first´s four samples with the scores values respect to five  PCs. We can see how the the score of the first sample respect to PC1 is negative, so when we multiply this value by every  value of the first loading, we change the sign of the values and the result change.
This happens also in the cases of PC2 and PC4, is not the case of PC3, with positive score value, so the shape of the result is the same.
Finally we can add the four results spectra to see the reconstructed first sample.The difference between the reconstructed and the original is the residual. Win ISI called this residual as the X residual.
This type of reconstruction is very useful in the discriminant analysis, the unknown sample is reconstructed with different models, the sample is identified in the group with the lowest X residual.

18 mar 2014

WinISI version 4.6.11.14874 (available for downloading)

WinISI version 4.6.11.14874  is available for downloading at www.winisi.com at the "Download Section".
There are new features and enhancements, and some defects from the previous versions are fixed.
See full details here.

2 mar 2014

NIPALS: Reconstruction of a Validation Set

In this post I calculate the scores of a validation set using the NIPALS loadings (Matrix P) calculated in the post: Using R: NIPALS Spectra Reconstruction
 
 Xval_orig<-scale(sflw.msc3.val$NIRmsc,center=TRUE,scale=FALSE)
matplot(wave.NIR,t(Xval_orig),type="l",lty=1,xlab="nm",
+ ylab="log 1/R")
 
Calculation of the scores is just a matrix multiplication of the centered validation matrix, by the P loadings matrix.
 
Tval_nipals<-Xval_orig %*% P_nipals
 
We have seen the loadings in the post: NIPALS: Correlation of the Scores with the Constituents
 
Now we can reconstruct the Xval with:
 Xval_recon<-Tval_nipals%*%(t(P_nipals))
matplot(wave.NIR,t(Xval_recon),type="l",lty=1,xlab="nm",
 + ylab="log 1/R")


Diference is the not explained variance, ramdon noise,....
 Eval<-Xval_orig-Xval_recon
matplot(wave.NIR,t(Eval),type="l",lty=1,xlab="nm",
+ ylab="log 1/R")