19 may 2015

Importing spectra from "R" into Win ISI

I wanted to import the Gasoline spectra from the PLS package into Win ISI, so the first thing I have done was to export the Gasoline spectra to a TXT file:

write.table(gasoline$NIR,"c:/gasoline3.txt",sep="\t")

and after that I use the tool Convert from Win ISI to convert the TXT file into a NIR file. It was not so easy, and I have to organize a little bit the TXT file.


The idea is to compare (in next posts) Win ISI tools with the R Chemometric packages.

9 may 2015

Educreations: Compartiendo Conocimiento

Muy interesantes la cantidad de herramientas de que disponemos para aprender y transmitir nuestros conocimientos de una manera lo mas didáctica posible. Una de ellas es Educreations, pero hay otras que quiero ir probando también. He hecho un pequeño video que podéis ver en vuestro iPad.
Lección 1: Quimiometria
Lección 2: Quimiometria

Es entretenido hacer estos videos en "Educreations", y compartirlos. La opción básica tiene ciertas limitaciones, pero podemos hacer un pago temporal si estamos haciendo un proyecto y queremos aumentar la capacidad de almacenamiento, exportar los vídeos a otros formatos, y disponer de más herramientas.


29 abr 2015

Centered Spectra vs. Loading Spectra

I´m preparing a presentation for a training about Chemometrics and PCAs,  so I´m going to use R Graphics, because are really fantastic to introduce NIR users to R.
 Following with the centered spectra, this time I overplot the centered spectra with the first 4 loadings. Every centered spectrum can be rebuild using a linear combination with their scores and the loading vectors (eigenvectors), remaining a residual noisy spectra (e).

28 abr 2015

Centered spectra vs. Std Spectrum



In my last post I added a video, with the idea of the centered spectra. The video is in Spanish, but I hope you can follow the script with R. 
The idea of this post is overplot the centered spectra with the standard deviation spectrum which also explain the wavelengths of the spectrum which has more variation. The script has to consider that we have two scales, so I put one on the left (centered spectra) and on the right the scale for the standard deviation spectra. We can see that the zone of variation matches.
NIR.mc<-scale(gasoline$NIR,center=TRUE,scale=FALSE)
matplot(wavelengths,t(NIR.mc),type="l",lty=1,
        col="blue",col.axis="blue",
        xlab="wavelength",ylab="log 1/R",
        main="Centered Spectra + STD Spectrum")
par(new=T)
#The standard deviation spectrum for gasoline$NIR is:
NIR.sd<-apply(gasoline$NIR,2,sd)
matplot(wavelengths,NIR.sd,type="l",lty=1,lwd=4,col="red",
        xlab="wavelength",ylab="log 1/R",
        axes=FALSE)
axis(4,col.axis="red")