Continuing with the vignette Modelling complex spectral data with the resemble package (Leonardo Ramirez-Lopez and Alexandre M.J.-C. Wadoux), now it is time to see the predictor variables which are reflectance values of the soil samples acquired in a NIR (Near Infrared Reflectance) instrument in the range from 1100 to 2498 nm in two nm steps, so we have 700 data points. We prepare a vector with the wavelengths and we call it "wav" (same as the vignette).
wavs<-NIRsoil$spc %>% colnames() %>% as.numeric()
Now we can se to the raw spectra (spectra without any treatment):
matplot(x = wavs, y = t(NIRsoil$spc),ylab = "Absorbance", type = "l",
Let´s create a new vector considering the wavelength reduction:
new_wavs <- as.matrix(as.numeric(colnames(NIRsoil$spc_p)))
and plot the spectra to see their appearance:
matplot(x = new_wavs, y = t(NIRsoil$spc_p),xlab = "Wavelengths, nm",
ylab = "1st derivative",
type = "l", lty = 1, col = "#5177A133")
Now in the data frame "NIRsoil" we have two spectra matrices, the raw spectra (spc) and the spectra reduced and math treated with the SG first derivative (spc_p).
We can check the dimensions of these matrices:
names(NIRsoil)"Nt" "Ciso" "CEC" "train" "spc" "spc_p"
dim(NIRsoil$spc)
825 700
dim(NIRsoil$spc_p)
825 276
In the next post we will continue the preprocessing process and preparation of the data as the vignette suggest, trying to understand the different procedures to model, as better as possible, the soil spectral data.
No hay comentarios:
Publicar un comentario