# "R" PLS Package: Multiple Scatter Correction (MSC)

[This article was first published on

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

**NIR-Quimiometría**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

**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 their blog:**NIR-Quimiometría**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.