## 3 QCCS Statistical Basis
### From the Confusion Matrix to the Set of Multinomial Distributions
To be rigorous, if we realize \(n\) independent trials where we carry out the cross-classification of an item in one of \(c=k\times k\) cells, we define \(X_{i},\ i=1,\ldots,c\) as the number of times that the outcome associated with cell \(i\) occurs after reordering the matrix by columns to construct a vector. So, the vector \(X=(X_{1},X_{2},\ldots,X_{c})\) is said to have a multinomial distribution with parameter \(n\), the number of trials, and the probability vector \(\pi=(\ \pi_{1},\ \ldots,\pi_{c})\), with each \(\pi_{i}\geq 0\) corresponding to the occurrence probability of the classification results in each cell, satisfying \(\sum\limits_{i=1}^{c}\pi_{i}=1\), in short, \(M(n,\pi)\). Hence, the mass probability function of this distribution \(M(n,\pi)\) is given by  
\[P[(X_{1}=n_{1},\ \ldots,X_{c}=n_{c})=\ \frac{n!}{n_{1}!\ldots n_{c}!}\pi_{1}^{ n_{1}}\ldots\pi_{c}^{n_{c}}, \tag{2}\]  
where \(\sum\limits_{i=1}^{c}n_{i}=n\). However, if the RDS has the quality to be a reference, not all possible values of this multinomial are feasible. Next, we point out two situations as illustrative examples:  
1. For any category \(\Gamma_{j}\) (reference), there are \(n_{+j}\) items in this column, so it is impossible to find a value \(n_{ij}>n_{+j}\) in the same column. This could be possible only if RDS is not considered as a reference, that is, without constraints in the randomness of the matrix. In addition, the \(n_{+j}\) elements can be correctly classified or confused with other categories, but they will always be located in the same column and never in other different columns (categories). This implies that the inherent randomness of the multinomial is not possible now. 2. According to Equation (2), a possible outcome of an \(M(n,\pi)\) can concentrate all items in one cell, say \((n,0,\ldots,0)\), but if RDS is considered to be a reference, this outcome will never be observed, because the values \(n_{+j}\) are always present and, in consequence, all outcomes are partially grouped into subsets that sum \(n_{+j}\). Therefore, as stated in Section 2, when RDS is considered as a reference, the values \(n_{+j}\) are fixed, and by redefining the outcomes for this number of trials, we can obtain a new multinomial distribution, one for each category. So, we take advantage of this fact and we propose to deal with the information contained in Figure 1 as the new structure called the \"quality control column set\" (QCCS) (Figure 2) in order to differentiate it from the classical confusion matrix concept. Now, each column in the QCCS structure can be modeled as a different multinomial distribution. Moreover, a column can be modeled as a binomial distribution if a single misclassification level is set for all other \((k-1)\) categories in the specifications (e.g., specification SpWa#2 in Table 1). The main advantage of this approach is that it allows us to assume specific quality requirements for each class analyzed and to test them. Now, we can propose a category-wise control method that allows us to establish levels of quality, category by category (column by column), related to the percentage of correctness in the classification for a particular class and to the percentage of possible misclassifications or confusions between classes. So, for each category and in a separate way, we can state a set of quality specifications, and in order to test whether such specifications are achieved or not, we propose an exact multinomial test.