## 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")

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]

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.