## 3 Proposed Method
### Goodness Function
The authors of [55] also showed discretization methods based on theoretical information complexity, and the methods based on statistical measures of data dependency are asymptotically equivalent. That is, both those and other discretization methods achieve similar goals in different ways. Therefore, in our work, to solve the aggregation problem, we will use two statistical criteria, namely, the Akaike information criterion (\(AIC\)), and the Bayesian information criterion (\(BIC\)), as well as their combinations. \(AIC\) is often used in feature selection tasks, for example, in a stepwise regression procedure. It provides a trade-off between the quality of fit and the complexity of the model (the number of parameters \(p\)). The indicator is calculated, as follows,  
\[AIC=2p+N\log ESS.\]  
\(BIC\) penalizes an increase in the number of parameters more severely  
\[BIC=p\log N+N\log ESS.\]  
Thus, according to the Akaike criterion, a more complex model will be obtained, while the use of the Bayesian criterion will lead to a division into a smaller number of categories. We propose to consider intermediate variants of the criteria by varying the penalty term for the model complexity. Thus, we introduce the following class of evaluation functions, defined by the parameter \(2\leq c\leq\log N\):  
\[Q=p\cdot c+N\log ESS. \tag{2}\]  
In order to represent \(Q\) as a function of the results of the grouping and discretization of the explanatory variables, we express the \(ESS\) in terms of the intragroup sums of squared deviations from the mean of the response. Let the model include three explanatory variables, and then the individual within-group sum of squares is calculated as  
\[ESS\Big{(}G_{ktj}\Big{)}=\sum_{i}y_{ktji}^{2}-\frac{\left(\sum_{i}y_{ktj}\right) ^{2}}{n_{ktj}},\]  
where \(G_{ktj}\) is a subset of \(n_{ktj}\) students of \(k\)-th gender, \(j\)-th group of departments, \(j=\overline{1,J}\), surveyed in the period \(t\), \(j=\overline{1,T}\), \(y_{ktji}\) is \(i\)-th observed value corresponding to the IQ value of students from the subset \(G_{ktj}\). Initially, each group of departments includes one department, each period includes one year. The residual sum of squares can be formulated as  
\[ESS\bigg{(}\cup\limits_{k,t,j}G_{ktj}\bigg{)}=\sum_{k,t,j}ESS\Big{(}G_{ktj} \Big{)}.\]  
When determining the number of parameters, it is necessary to consider that for some combinations of the factors levels there are no observations in the subset \(G_{ktj}\), therefore  
\[p\Big{(}G_{ktj}\Big{)}=\mathrm{I}\Big{(}G_{ktj}\
eq\varnothing\Big{)},\]  
where \(\mathrm{I}(\mathrm{S})\) takes the value \(1\) if the statement \(\mathrm{S}\) is true, and takes the value \(0\) otherwise. Then the total number of parameters will be  
\[p\bigg{(}\cup\limits_{k,t,j}G_{ktj}\bigg{)}=\sum_{k,t,j}\mathrm{I}\Big{(}G_{ktj }\
eq\varnothing\Big{)}.\]  
Thus, the goodness function is defined by  
\[Q\bigg{(}\cup\limits_{k,t,j}G_{ktj}\bigg{)}=p\bigg{(}\cup\limits_{k,t,j}G_{ktj }\bigg{)}\cdot c+N\log ESS\bigg{(}\cup\limits_{k,t,j}G_{ktj}\bigg{)}. \tag{3}\]  
While solving the problem of grouping and discretization, a set of subsets \(G_{ktj}\) is formed that would minimize the function (3). Therefore, the optimization problem can be formulated follows  
\[F=\frac{R^{2}}{1-R^{2}}\frac{N-p}{p-1},\]0  
It should be borne in mind that with a very large number of categories, building good groupings is difficult, due to the risk of overfitting the model. As a last resort, to avoid overfitting, efficient grouping algorithms can combine all values into one group, thereby excluding the variable from consideration. In order to prevent such a situation, the stopping criterion must include a condition for the minimum number of categories (for example, two).