## 3 QCCS Statistical Basis
### The Exact Multinomial Test  
From now on, in order to maintain the notation as simple as possible, we are going to test the null hypothesis of Equation (3) for a fixed category, say \(\Gamma\), that will represent any of the set \(\{\Gamma_{1},\Gamma_{2},\ldots,\Gamma_{k}\}\), and hence we will test whether the thematic quality specifications previously stated are achieved or not in the sense of the null hypothesis \(\mathbb{H}_{0}\). Thus, we consider that for a particular category \(\Gamma\), we have \(m\) elements to classify (which corresponds to its marginal value in Table 2), and we define \(X_{1}\) as the number of elements correctly classified in the main class \(\Gamma\), and we define \(X_{i},i=2,\ldots,q\), \(q\leq k\) as the number of misclassifications between the main class and the rest of the classes in decreasing order, assumed in the misclassification levels. In this way, we obtain a multinomial vector \(X=\left(X_{1},X_{2},\ldots,X_{q}\right)\) with the parameter \(m\) and the probability vector \(p_{0}=\left(p_{10},p_{20},\ldots,p_{q0}\right)\), \(p_{i0}\geq 0\), \(\sum\limits_{i=1}^{q}p_{i0}=1\), with \(p_{10}\geq p_{20}\geq\ldots\geq p_{q0}\), with \(p_{i0}\) being the percentage stated in the limits expressed in a set of specifications (e.g., Table 1) under the null hypothesis. To test Equation (3), an exact test is proposed. Remember that an exact test calculates the empirical probability of obtaining an outcome as different from the null hypothesis as to the outcome observed in the data. So, the \(p\)-value is computed by adding up the probabilities of feasible outcomes in \(M(m,p_{0})\) (say, \(P[X=x]\)) under the alternative hypothesis, starting from the observed classification results. To decide when a classification result \(X=\left(x_{1},x_{2},\ldots,x_{q}\right)\) is worse than \(Y=\left(y_{1},y_{2},\ldots,y_{q}\right)\) according to the specifications (denoted by \(X<_{m}Y\)), we consider the following partial order relation between \(X\) and \(Y\) in the set \(\left\{x_{1},x_{2},\ldots,x_{q}\in\left\{0,1,\ldots,m\right\}:\sum\limits_{i=1 }^{q}x_{i}=m\right\}\), which is similar to the lexicographic order, in the following sense,  
\[ \begin{array}{c}X<_{m}Y\text{ if }(x_{1}<y_{1})\vee\\ \left\{(x_{1}=y_{1})\wedge(x_{2}>y_{2})\right\}\vee\\ \left\{(x_{1}=y_{1})\wedge(x_{2}=y_{2})\wedge(x_{3}>y_{3})\right\}\ldots\ldots \ldots\\ \left\{(x_{1}=y_{1})\wedge\ldots\wedge\left\{x_{q-1}=y_{q-1}\right\}\right\} \wedge\left\{x_{q}>y_{q}\right\}\end{array}  \tag{4}\]  
where \(\wedge\) and \(\vee\) represent the basic operators of Boolean algebra \"AND\" and \"OR\", respectively. \(X=\left(x_{1},x_{2},\ldots,x_{q}\right)\) is equivalent to \(Y=\left(y_{1},y_{2},\ldots,y_{q}\right)\) if \(x_{i}=y_{i},\ 1\leq i\leq q\), (denoted by \(X=_{m}Y\)). So, given the observed classification, say \(Y^{*}=\left(y_{1}^{*},y_{2}^{*},\ldots,y_{q}^{*}\right)\), the \(p\)-value is obtained as:  
\[p=\sum\limits_{X\leq_{m}Y*}P_{0}[X=x] \tag{5}\]  
where \(P_{0}[X=x]\) denotes the probability mass function under the null hypothesis, \(M(m,p_{0})\). In Appendix A, a detailed calculation of the exact \(p\)-value is included. This technique has been previously used for inference purposes involving multinomials. For instance, for the positional accuracy quality control of spatial data in [38, 39] and in general for testing problems in contingency tables ([40, 41], among others). Once the \(p\)-value is calculated, the rule set is:  
1. For a single column, the null hypothesis in Equation (3) should be rejected if the \(p\)-value obtained is less than the nominal value \(\alpha\). 2. For L categories/columns, \(2\leq L\leq k\), we calculate the corresponding \(p\)-values for each testing problem. Assuming independence between the tests, we can state the global hypothesis of the quality requirements. To assure that the global size of the type I error is less than or equal to \(\alpha\), the Bonferroni criteria are used [42].