## 2 Materials and Methods
### Statistical Method
On the one hand, the decision limit when PL = 0 (CC\(\alpha\)) is \"_the concentration limit at and above which it can be concluded with an error probability of \(\alpha\) that a sample is non-compliant when it truly is_\". On the other hand, the detection capability (CC\(\beta\)) definition is different depending on if a PL is established or not. For prohibited or unauthorized substances, CC\(\beta\) is \"_the lowest concentration at which a method is able to truly detect or quantify, with a statistical certainty of 1 - \(\beta\), samples containing residues of prohibited or unauthorized substances_\" whereas for the case of authorized substances with an established PL, it is defined as \"_the concentration at which the analytical method is able to detect concentrations_ below the permitted limit with a statistical certainty of 1 - \(\beta\)\". CC\(\alpha\) and CC\(\beta\) were already established for PL = 0 by ISO 11843-2 [37] and IUPAC [38] and can be generalized for any other PL value, where they will be named as CD\(\alpha\) and CD\(\beta\), respectively, to distinguish them from the terms already established in the regulatory framework mentioned above (when the calibration is univariate). On the contrary, when the calibration is multivariate, and in particular, if for a given parameter, x, it is considered a minimum permitted (or established) limit, PL = x\({}_{0}\), the corresponding one-tailed hypothesis test should be outlined as in Equation (1). The word one-tailed specifies that the alternative hypothesis of the test is not an inequality. \[ \begin{array}{l}\text{H}_{0}\text{: }\text{x = x}_{0}\text{ (the parameter is greater than or equal to x}_{0}\text{, compliant sample)}\\ \text{H}_{\text{a}}\text{: }\text{x < x}_{0}\text{ (the parameter is less than x}_{0}\text{, non-compliant sample)}\end{array}  \tag{1}\]  
For example, if it is wanted to guarantee that the fat content of a milk sample is at least 12%, then the minimum permitted limit is PL = x\({}_{0}\) = 12%. The hypothesis test allows one to decide, with a probability of false non-compliance (\(\alpha\)) and false compliance (\(\beta\)), whether a new sample, based on its NIR spectrum, fulfils the minimum PL or not. To build the hypothesis test of Equation (1), the procedure begins with a PLS calibration, \(\text{y = f}_{\text{PLS}}(\text{s})\), which assigns a concentration (y) to the NIR spectrum (**s**) of a sample of which the concentration measured using a reference accredited method is x. From the calibration data (x\({}_{i}\),y\({}_{i}\)) i = 1,... I, the accuracy line y = a + bx, previously defined in Section 1, is built. On another note, CD\(\alpha\) is related to the probability of false non-compliance, \(\alpha\). That is, \(\alpha\) is the probability of deciding that the tested sample is non-compliant when it truly was. In other words, \(\alpha\) is the significance level in the hypothesis test of Equation (1). For a given \(\alpha\), the probability of a false compliant decision (\(\beta\)) is the probability of wrongly affirming that the tested sample has a value of the parameter greater than or equal to x\({}_{0}\), i.e., to conclude that it is compliant, when it was not. The capability of detection (CD\(\beta\)) is the value of the parameter related to this decision and is computed as in Equation (2):  
\[\text{CD}\beta=\text{x}_{0}-\frac{\Delta(\alpha,\beta)\text{w}_{x_{0}}\hat{ \sigma}}{\hat{\text{b}}} \tag{2}\]  
where \(\hat{\sigma}\) is the residual standard deviation of the accuracy line, \(\hat{b}\) its slope, and \(w_{x_{0}}\) is defined according to Equation (3), where it can be observed that it depends on the position of the standards in the accuracy line (x\({}_{i}\), i = 1,... I), the number of sample replicates (r), and the number of standards (I).