17 sept 2015

RMS calculation in the Diagnostics

If you are use to work with ISI Scan, you can see a noise statistic summary for every cycle (totally 10) of the noise spectra, and two of those statistics are the bias and RMS.

Here I show the statistics for the first four cycles, but we only consider the NIR segment:

 
This post checks how ISI Scan calculates the RMS, and we can see that this RMS value is the RMS corrected by the Bias, so it tells us a measure of the random noise.
I show a simple script showing this:
cycle1<-noise[1,]
cycle2<-noise[2,]
cycle3<-noise[3,]
cycle4<-noise[4,]
 
options(digits=2)
rms1<-sqrt(mean((cycle1)^2)-(rowMeans(cycle1))^2)
rms2<-sqrt(mean((cycle2)^2)-(rowMeans(cycle2))^2)
rms3<-sqrt(mean((cycle3)^2)-(rowMeans(cycle3))^2)
rms4<-sqrt(mean((cycle4)^2)-(rowMeans(cycle4))^2)
> rms1
    1 
0.014 
> rms2
    2 
0.016 
> rms3
    3 
0.011 
> rms4
    4 
0.015 

4 sept 2015

Looking to the Residual Matrix


The first plot shows in blue color the residual Matrix "E", after developing a principal components calculation with SVD of some samples of wheat flour without any additive (training set).
Additive (ascorbic acid) was added to the flour in certain levels (50, 100, 200 and 500 ppm) to build a validation set. After acquiring the spectra, I reconstruct these spectra with the loading matrix "P" calculates with the SVD using the training samples. First I calculate the scores anf after the reconstructed spectra multiplying the scores with the P transpose matrix.
Once I get the reconstructed spectra, I subtract the reconstructed from the original validation set, and I get the residuals, that I overplot with red color over the blue ones.
I can see that the RMS is higher, and there is some shape different from the random noise of the blue spectra, so the good product model can be tuned to reject this validation set with some RMS cutoff.
Does this shape something from the spectra from the pure additive?
 
 

In green color we can see the spectra of the ascorbic acid, and I convert it into the residuals scale, and where I see certain similarities is in the band at 2250 nm, where all the peaks from the residuals of the validation set, and the ascorbic peak have the same shape.
Anyway this is a simply study about how residuals could help us to determine if the samples can be considered as Good Product, or they are out of specifications and further investigation is needed studying the residuals to determine the cause.