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):

*Related*

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 on topics such as:

Data science,

Big Data, R jobs, visualization (

ggplot2,

Boxplots,

maps,

animation), programming (

RStudio,

Sweave,

LaTeX,

SQL,

Eclipse,

git,

hadoop,

Web Scraping) statistics (

regression,

PCA,

time series,

trading) and more...

If you got this far, why not

__subscribe for updates__ from the site? Choose your flavor:

e-mail,

twitter,

RSS, or

facebook...

**Tags:** "R" Chemometrics