(This article was first published on

**NIR-Quimiometría**, and kindly contributed to R-bloggers)From the

**previous post**, we can make the difference spectrum (once the samples are sorted by moisture) between the sample with the lowest moisture value (position 1), from the sample with the highest moisture value (position 66). This spectra will help us to understand where are the band positions (should be positive) for the moisture. Of course other bands will appear, because these two samples have different values for the other constituents, so we must be careful with this.It is important to know the inter-correlations between the different constituents.

I multiplied the difference spectra by 10, in order to see better the bands.

**min_moi<-moiNIR_msc$NIRmsc[1,]****max_moi<-moiNIR_msc$NIRmsc[66,]****diff_moi<-max_moi-min_moi****diff_moi10<-ext_moi*10****mix_moi<-rbind(min_moi,max_moi,diff_moi10)****matplot(wave_nir,t(mix_moi),lty=1,pch=”.”,****+ xlab=”wavelength”,ylab=”log(1/R)”)**

We can see two big positive bands at 1940 nm (combination band), and other at 1450 nm (1º overtone) due to the water.

We can do the same procedure with other math treatments, but the spectra can be more difficult to interpret.

The difference spectra will help us to understand better the loadings 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 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...