# Standard Normal Variate (SNV)

[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.

This is another pretreatment used quite often in Near Infrared to remove the scatter. It is applied to every spectrum individually.

The average and standard deviation of all the data points for that spectra is calculated. Every data point of the spectra is substracted from the mean and divided by the standard deviation.

“R” has a function to center and scale every vector which we can use to get the SNV spectrum. Let´s apply this function to our known Yarn NIR data.

**> X<-yarn$NIR**

**> Xt<-t(X)**

**> Xt_snv<-scale(Xt,center=TRUE,sd.scale=TRUE)**

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

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

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

Look at the Y axis and compare it with the data without SNV applied (Raw Yarn spectra):

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.