## Materials and Methods
### Chemometrics  
Raw data were obtained as explained in Section 2.5. Due to the high number of samples (\(n=305\)) and data complexity, the lcoshift algorithm was applied to five individual analytical batches, in order to pre-align them before aligning them altogether. The resulting aligned data matrix, consisting of as many columns as variables (16,347 data points) and as many rows as samples (\(n=305\)), was imported into SIMCA software v13.0(r) (Umetrics Sartorius-Stedim, Malmo, Sweden). After data pre-processing by scaling to unit variance and mean centring, a PCA with all samples (\(n=305\)) was performed, aiming at multivariate data exploration and detection of potential outliers through Hotelling's \(T^{2}\) and \(Q\)-residuals. Then, PLS-DA was applied to develop a 2-step hierarchical classification strategy with the full sample set (\(n=301\)), outliers excluded. Figure 1 summarizes the hierarchical classification strategy. PLS-DA is a supervised discriminant technique that finds the most different features between categories while minimizing those variables not related to a given category; it is based on finding the maximum correlation between the data and each of the categories, being able to handle noise in the data. In this approach, two consecutive binary PLS-DA models discriminated among the three commercial categories of virgin olive oil in two steps, as our previous work showed that this was more successful than a PLS-DA model with the three categories [14]. First, the PLS-DA model EVOO vs. non-EVOO samples (values of the PLS dummy variable were 1 for EVOO and 0 for non-EVOO) was used to discriminate these classes by means of predicted values (PV). Then, a second PLS-DA model, VOO vs. LOO (values of the PLS dummy variable were 1 for LOO and 0 for VOO), was applied to  
Figure 1: Flow chart of the two-step hierarchical classification strategy to classify virgin olive oils into their quality grades: extra-virgin (EVOO), virgin (VOO) and lampante (LOO) olive oils. PV: predicted values. predict the category of non-EVOO samples. Both PLS-DA models were optimized by leave 10%-out cross-validation. This hierarchical classification strategy was also followed by subsequent studies in this matter [18,26]. Then, as suggested by [PERSON] et al. [14], the classification criterion included an uncertainty range to which boundary samples were assigned, those with PV within the uncertainty range. Here, ROC analysis was applied to both PLS-DA models in order to set the thresholds of the uncertainty ranges. Therefore, two ROC curves (one for EVOO vs. non-EVOO models and another one for VOO vs. LOO models) were built up with the PV obtained in the leave 10%-out cross-validation and the true category for each sample in each binary model. A ROC curve plots the sensitivity and 1-specificity values that are obtained when the PV threshold to assign samples to a diagnostic category varies (in this case, the EVOO category in the EVOO vs. non-EVOO model, and the LOO category in the VOO vs. LOO model) [36]. In order to maximize the classification performance, the PV that led to sensitivity (true positive rate) and specificity (true negative rate) equal to 1 in each PLS-DA were respectively taken as the lower and the upper thresholds of the uncertainty range (Figure 1). Thus, in the first model, virgin olive oil samples with PV above the fixed upper threshold were classified as EVOO, those with PV below the lower threshold (non-EVOO) were subjected to further classification by the second model and those with PV in between were considered uncertain to classify. On the other hand, the second model classified the non-EVOO as LOO (PV > upper threshold), VOO (PV < lower threshold), or uncertain (PV between thresholds) (Figure 1). The sample set was randomly split seven times, each time into a training set, with the 80% of samples from each category (\(n\) = 241; 98 EVOO, 86 VOO and 57 LOO), and an external validation set with the remaining 20% of samples (\(n\) = 60; 24 EVOO, 22 VOO and 14 LOO).