(This article was first published on

**NIR-Quimiometría**, and kindly contributed to R-bloggers)**MSC (Multiple Scatter Correction)**is a Math treatment to correct the scatter in the spectra. The scatter is produced for different physical circumstances as particle size, packaging.

Normally scatter make worse the correlation of the spectra with the constituent of interest.

Almost all the chemometric software’s available include this math treatment and of course “R” have it as well in the “PLS Package”.

Following the Journal of Statistical Software (January 2007, Volume 18, Issue 2) there is a nice tutorial about how to use the PLS Package (Bjorn-Helge Mevik & Ron Wehrens).

The idea of this post is just compare graphically the spectra without any treatment and with the MSC treatment using the Near Infrared Data “yarn” from “R”.

**> yarn**

**> wavelengths<-seq(1,268,by=1)**

**> matplot(wavelengths,t(yarn$NIR),lty=1,pch=21**

**+,xlab="data_points(nm)",ylab="log(1/R)")**

This is the spectra of the 28 samples without any treatment:

**> Ztrain<-msc(yarn$NIR)**

**> colnames(Ztrain)<-c(1:268)**

**> matplot(wavelengths,t(Ztrain),lty=1,pch=21,**

**+ xlab="data_points(nm)",ylab="log(1/R)")**

This is the spectra of the 28 samples with MSC applied:

We can see the differences in the log(1/R) scale (Y axis).

Tweet

To

**leave a comment**for the author, please follow the link and comment on his blog:**NIR-Quimiometría**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...