Standard Normal Variate (SNV)

February 19, 2012

(This article was first published on NIR-Quimiometría, and kindly contributed to R-bloggers)

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 his blog: NIR-Quimiometría. 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...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...


Comments are closed.