5 mar 2012

NIT: Fatty acids study in R - Part 003

We are going to use the spectra treated with MSC to continue with this tutorial, and as we saw in the first post, the spectra looks like this:
One way to see the variability in the spectra is to center the spectra, we only have to substract the mean spectra from every spectrum.
One easy way to do it is:
NITmsc_c<-scale(fattyac_msc$NITmsc,
center = TRUE,scale = FALSE)
par(mfrow=c(1,1))
matplot(wavelengths,t(NITmsc_c),lty=1,pch=NULL,
type="l",xlab="wavelengths",ylab="Abs")
 



Another way to see the variabiñity in the spectra is the standard deviation spectrum, in this case we calculated it (in red color) and overplotted over the previous plot of centered MSC spectra.
sdNITmsc_c<-as.matrix(apply(NITmsc_c,2,sd))
par(new=T)
matplot(wavelengths,sdNITmsc_c,lty=1,pch=NULL,
  type="l",col="red",lwd=2,xlab="wavelengths",ylab="Abs")

 

Looking to the loadings:
We saw the scores (T matrix) in the previous post, let´s have a look to the loadings (P matrix).
>  fatmsc_nipalsP4pc<-fatmsc_nipals$P[,1:4]
> loading1<-fatmsc_nipalsP4pc[,1]
> loading2<-fatmsc_nipalsP4pc[,2]
> loading3<-fatmsc_nipalsP4pc[,3]
> loading4<-fatmsc_nipalsP4pc[,4]

It is interesting to find interpretation to these plots, for this is important to look carefully to all the plots (scores,loadings, original spectra,…), and also to consult bibliography about the position of the NIT bands for C-H, O-H,.., bonds.
In this case MSC does not remove totally the scater, so scatter continues beeing a high source of variance represented by the first PC.But once is removed we can see better bands in the other loadings.
Lets find the peaks in the loadings:
findPeaks(loading2)   #X878 X932 X972
findPeaks(loading3)   #X904 X944
findPeaks(loading4)   #X898  X916  X966  X998 X1004 X1010 X1028 

Let´s mark the most relevants over the loadings plots
  
  If you want to follow this tutorial, please send me an e_mail. I´ll send you the “txt” file attached.


No hay comentarios:

Publicar un comentario