Along several posts we will practice the use of Caret with spectroscopic data from an Infratec Instrument. The first thing we will do, is to load the library and the data which contain the spectroscopic and reference values.
#Loading the datadata(tecator)
?caret::tecator #Details about the tecator data
Two tables are loaded, one with the spectroscopic data (absorp), and another with the reference values (endpoints).
dim(endpoints)dim(absorp)
We can see that we have 215 samples measured at 100 data points in the spectroscopic data, and three parameters with reference values.
The data points goes from 850 to 1048 every two nm, so they are in total 100 data points, and the reference values are for Moisture, Fat and Protein. As we can read in the Help info, the samples are chopped pure meat measured in transmittance.
We can see first the structure of the data is numeric
str(absorp)str(endpoints)
and their class (matrix)
class(absorp)class(endpoints)
We have a matrix for the absorption values and a matrix for the reference values. Let´s see the raw spectra
matplot(seq(850, 1048, by = 2), t(absorp),
xlab = "Wavelengths", ylab = "Absorbance",
main = "Meat spectra", type = "l")
As we can see, due to the particle size, differences in the pathlength and other physical circumstances, there is quite a lot scatter in the spectra, so this physical variables are with others (chemical) data that we will have to treat and manage to develop models.
No hay comentarios:
Publicar un comentario