## 3 Results  
### PLS Calibration  
According to the experimental data described in Table 1, a PLS calibration was built for each analyte individually. The data were pretreated as indicated in Table 2. In every case, the standard normal variate (SNV) was applied to reduce the (physical) variability between samples due to scattering. It was also applied to the adjustment for baseline shifts between samples. Except for the protein determination in yogurt, a derivative was also always applied after the SNV. The first derivative was used for corrections of the baseline, and the second derivative to eliminate both the baseline and linear trends. The former has been used for the butter model, whereas in the others, the second derivative was used. The derivatives have been applied using the Savitsky-Golay method with a second-degree polynomial and a window width varying from 7 to 15 points, as shown in Table 2. The derivative order, the polynomial degree, and the window width have been chosen after testing several different combinations to improve the PLS model, which is why in the case of yogurt, the preprocessing method is different for protein (being just the SNV the one that provided the best results). A review of preprocessing methods for NIR spectra can be consulted in reference [40]. Also, in Figure S2 of the Supplementary Material, these explained effects can be observed by comparing the raw spectra with the pre-processed ones for each food matrix. Centering the NIR spectra after preprocessing them has a huge impact on the PLS calibration models. In a qualitative way, PLS can be described as a regression technique that searches for directions in the space of predictor variables such that they explain the greatest variance and, at the same time, that they are as highly correlated as possible with the response. As a consequence, if the predictor variables (preprocessed spectra) are not centered, the direction of greatest variability will be the one that connects the vector of means of the data with the origin of the coordinates. From the perspective of the PLS regression, it is highly recommended to center the preprocessed spectra, which is what has been performed in every case studied in this work (see Table 2). The number of the LV of the models, also indicated in Table 2, was selected according to the minimum value of Root Mean Squares Error of Cross-validation (RMSEC), obtained by applying the venetian blinds method in all cases, since there were many objects in random order. Three samples per blind were selected to avoid the replicate sample trap with a variable number of splits, depending on the size of the data matrix. In the case of olives, the number of samples per blind was just one, given that each spectrum was obtained as an average of eight spectra originating from one olive. The explained variance of the models ranged between 90.32% and 98.60%, both for the predictors and for the response, having found few outliers. After the models were built, the Root Mean Square Error of Prediction (RMSEP) was calculated using an external prediction set to reflect the predictive ability of the model. As can be seen in Table 2 that the RMSECV and RMSEP values are quite similar, what indicates the stability of the models and their predictive ability.