Modelling complex spectral data with the resemble package (Leonardo Ramirez-Lopez and Alexandre M.J.-C. Wadoux)
From certain time I am interested in the use of NIR spectra to develop models, and to follow this tutorial can help me to understand better how to apply several type of regressions and to see the performance for this complex matrix like soil.
Let´s create a new R Markdown file (.Rmd), and load the three libraries that we will use:
library(tidyverse)
library(resemble)
library(prospectr)
library(magrittr)
data("NIRsoil")
NIRsoil$Nt %>%
summary()
NIRsoil%>%
ggplot(aes(Nt)) +
geom_histogram()
It is important to check how the response variables correlate between them:
response<- NIRsoil[ , 1:3] %>%
drop_na()
corrplot(cor(response), method = "number")
response %>%
ggplot(aes(x = Ciso , y = Nt)) +
geom_point()




