Analysis of Judiciary Expenditure and Productivity Using Machine Learning Techniques

: Maintaining the judiciary requires a high level of budgetary expenditure, but the speciﬁcs of this relationship have not yet been fully explored. While several studies have examined the impact of spending on the judiciary through measures related to productivity and performance, none have used machine learning techniques. This study examines the productivity of the court system based on expenditures and other variables using machine learning techniques. In the clustering process Brazilian courts are ranked according to their productivity, while in the neural network step it is veriﬁed which characteristics are most relevant at the budgetary level related to judicial productivity for each cluster formed in the ﬁrst step. The ﬁnal neural network model supports the results of Pearson’s parametric correlation test, which found no signiﬁcant correlation between expenditure and productivity. The ﬁndings from this study demonstrate the importance of understanding that increasing public budget expenditures alone is not sufﬁcient to improve the efﬁciency of the judicial system. Instead, other administrative measures are necessary to meet the demands of the Brazilian judiciary and improve service delivery rates. These results offer important theoretical and managerial contributions to the ﬁeld.


Introduction
Justice delayed is justice denied. Efficient court systems are crucial to maintaining the legitimacy of a country's judicial system and preventing a loss of public trust in the political system as a whole, which can have significant economic consequences [1]. he judiciary plays a critical role in establishing civil society and upholding the rule of law [2,3] and is, therefore, a fundamental institution for structuring society [4].
It is indisputable that the effective administration of the justice system plays a fundamental role in the preservation and stability of any democratic regime [5,6]. Furthermore, there is a growing recognition that a judicial system capable of resolving cases fairly is a fundamental prerequisite for the economic development of countries [7,8] Despite its importance, the judiciary faces numerous challenges in handling the high volume of cases it receives each year. One of these challenges is to increase efficiency and reduce processing times. Poor judicial performance is a global problem that various authors have extensively discussed, and it is not unique to the Brazilian context [9].
One area of study related to judicial performance is the examination of its determinants, which typically involves analyzing the judiciary of a given country as a whole [1]. This approach considers both internal factors, such as the judicial structure, the number of judicial units, the number of civil servants and magistrates, and the resources invested, among other factors, as well as external factors, such as educational indices, economic indicators, geographic distance to the judicial units, the social vulnerability of the jurisdiction, the cultural issues related to the citizen, and other factors.
In a report published by the World Bank, ref. [7] discuss the findings from a quantitative survey that examined factors influencing judicial efficiency in ten developing countries across three continents. The study employed jurimetric analysis to evaluate how various factors affect procedural times, including budgetary issues and the managerial style of magistrates. The data were categorized into three main groups: procedural, administrative, and organizational factors.
It is worth noting that the slow speed of the judicial system is a common complaint, both in the literature and the media, regarding the time courts take to issue their decisions [10]. However, it is essential to recognize that Brazil's problem goes beyond legal issues, as it is also a cultural, political, and social issue. The poor performance of the Judiciary Power is a significant problem that needs to be addressed. Therefore, reforming procedural law alone is not enough to improve the judiciary's performance [11].
It is worth mentioning that workload is an important issue related to the judiciary's work, as it is known that Brazilian magistrates are under extreme pressure due to a high volume of cases, sometimes reaching millions in some regions of the country. Reports from the National Council of Justice (CNJ) confirm the severity of this issue [9]. However, increasing the number of judges alone cannot guarantee a linear and automatic increase in productivity, as overburdened judges may see a decline in their performance with the arrival of new magistrates [12]. Studies have shown that the magistrate's experience and the number of advisors in their office influence judicial productivity [4]. It is important to note that improving these factors can contribute to the efficiency of the judiciary, beyond merely increasing the number of judges.
From this perspective, it is important to consider the budgetary expenditure of the judiciary as it can significantly impact judicial productivity and performance, ultimately affecting the quality of the service provided to citizens and organizations. In 2020, the judiciary's budgetary expenditure in Brazil was approximately BRL 100 billion [13], underscoring the importance of accountability and transparency to allow citizens to better understand how the judiciary functions and its impact on society [14].
Furthermore, issues related to the efficiency of the justice system are rooted in the assumption that the courts' fundamental purpose is to provide justice for society. Therefore, courts must aim to maximize the number of resolved cases to ensure the smooth functioning of society.
However, achieving this goal is not without challenges, including the high workload of magistrates, the need for judicial reform beyond just procedural law changes, and the influence of factors such as experience and the number of advisors on judicial productivity [15].
The goal of this project is to examine the productivity of the judiciary based on spending and other variables using machine learning techniques. The objective is to determine whether resources are being efficiently allocated and used, both in terms of human and material resources and to explore whether productivity is linked to how these resources are distributed.
State of the Art on the Productivity of the Judiciary It appears that public sector administration has become a demanding challenge for public policy makers, managers, and civil servants. This fact makes management particularly challenging in developing countries and in the economic transition, as is the case in Brazil [16]. In the public sector, efficiency, effectiveness, and the ability to meet the needs of citizens are required [17].
It is possible to observe that approaching the concept of performance necessarily implies dealing with certain issues that researchers must consider. These issues include: (1) having a solid theoretical foundation on the nature of performance, that is, a theory that establishes which measures are appropriate in a given research context; and (2) relying on a consistent theory about the nature of the measures, that is, the existence of the literature that defines which measures should be combined and which method would be most appropriate to build such measures [18].
Performance by the court system is of great social importance. However, it is observed that research in this area is still in its early stages in terms of the number of articles produced, in addition to being lacking in a theoretical and methodological systematization that can contribute to the institutionalization of knowledge on the subject [14].
The factors influencing the efficiency or inefficiency of the judiciary's performance have been extensively explored in the literature, particularly the antecedents of productivity. One observed issue affecting judicial performance is the number of cases per magistrate, also known as judicial demand. Some authors have suggested that an increase in demand leads to an increase in the judiciary's performance, but there is a limit to this relationship, and performance starts to decrease as the number of cases per judge increases [19].
The relationship between judicial performance and judicial demand is not a simple linear one, and a quadratic model provides better insights into how judicial productivity works [20]. An increase in demand can initially increase productivity because judges take less time to analyze a case to avoid case backlog, but this relationship does not necessarily hold in practice [9,19]. For example, despite an increase in demand reported by the CNJ, judicial productivity has remained stagnant for several years [21].
To measure the productivity of the judiciary, several variables have been considered relevant, such as the number of lawyers, servers, workload, and outsourced employees, while others, such as the number of conciliators, have been discarded [22].
A study has shown that the workload of judges can decisively affect their productivity, with a decrease occurring when new judges are appointed [19]. This relationship is known in the literature as the "exogenous productivity" of magistrates, which refers to the apparent contradiction that there is more productivity with a greater stock of cases. This has been documented in the literature and confirmed by a prior study [23].
Several factors, including staff ratio and the complexity of the work, influence the productivity of the judiciary. Higher courts are particularly impacted by the staff ratio, which can prolong the time required to resolve claims [24]. However, data collection inconsistencies can hamper the analysis of productivity in certain branches of the judiciary that achieve good productivity in some periods, but not in others.
For instance, the report "Justice in Numbers" highlights the existence of possible inconsistencies in the measurement of variables collected in various branches of justice.
Regarding the number of sitting judges, Dimitrova-Grajzl et al. [25] found no statistically significant effect on court output in district courts, regardless of the estimation technique employed. Similarly, the judicial team's statistical significance in explaining the number of cases resolved decreases when controlling for unobserved heterogeneity invariant at the time and court level in local courts.
The literature review suggests that the efficiency of the judiciary is essentially a multilevel construct, with human resources, the complexity of the work, the number of assistants, and the use of technologies being the most used variables to measure efficiency. The reciprocal influence of one level of the judiciary on another further complicates the analysis [14].
The policy of allocating human resources based on workload has been identified as a problem due to the lack of correlation between the number of magistrates and the demand on courts, particularly in peripheral regions [26]. This supports research results suggesting that efficiency can be improved without changing the number of resources used, particularly human resource inputs [27].
Creating specialized courts is an effective strategy to boost speed without increasing costs [28], as it specializes the judicial units in the judgment on demands for related objects, generating a kind of division of labor or specialization of functions.
Given the multiplicity of approaches and variables used to measure "judicial performance", Gomes and Guimarães [14] have conducted a literature review analyzing studies on the performance of the judiciary in various countries. They emphasized the dimensions researched in the primary studies related to the Administration of Justice area, highlighting the diversity of variables used, as shown in Table 1.  [14].
The study of variables that impact judicial performance is vast and can yield various nuances and directions regarding expenditure and investment decisions, workload distribution, and human resources management. This complexity arises from the multidimensional and multifaceted nature of the phenomenon, which encompasses several concepts and diverse issues, including managerial, technical, procedural, normative, social, economic, and organizational aspects, among others.
Rosales-López [29] identifies several factors that complicate the assessment of judicial performance. These factors include the complexity of the organizational and institutional structure of the judicial system, the scarcity or absence of basic data on judicial activity, the existence of biases among key actors concerning the evaluation and quantification of variables that are supposedly unquantifiable, such as the quality of judgments and the distribution of justice, and the fact that judicial performance can be affected by external actors, such as lawyers, who have a stake in the system.
It is important to note that the judiciary of a given society is deeply influenced by the context in which it operates, as pointed out by Rosales-López [29] regarding the "complexity of the organizational and institutional structure of the judicial system". Therefore, it is necessary to describe the main aspects of the judicial structure of a given country to better understand how it operates.
The Brazilian Judiciary Power's current structure is detailed in the Federal Constitution of the Federative Republic of Brazil of 1988, which includes organizations such as the Federal Supreme Court, National Council of Justice, Superior Justice Tribunal, Superior Labor Court, Federal Regional Courts and Federal Judges, Labor Courts and Judges, Electoral Courts and Judges, Military Courts and Judges, Courts, and Judges of the States and the Federal District and Territories [3]. However, Brazil's justice system encompasses various organizations operating in different contexts and assigned distinct roles and objectives, such as the Public Ministry, Public Defender, private law, police organizations, and prisons [30]. Over the past few years, there has been mounting social pressure for reforms to the judiciary. The National Congress responded by passing Constitutional Amendment n. 45/2004, also known as the "Judiciary Reform", aimed at reducing the effects of the "Judiciary Crisis", particularly the slow pace of the judiciary [31].
The efficient administration of a judicial system is a central issue for the civility of relations, contributing to social cohesion and the social and economic development of a specific country. In addition, it is important to note that this system has the potential to promote social relations based on ethical and moral principles and values, which include respect for the norms that govern social and commercial relations, as well as the rights of social groups and individuals [30]. The Brazilian judicial system has undergone significant changes with the approval of Constitutional Amendment n. 45/2004 [31,32]. These changes include: (1) the prediction of a reasonable duration for the process, (2) the proportionality between the number of judges and the demand for justice, (3) the uninterrupted functioning of jurisdictional activity, (4) the immediate distribution of cases, and (5) the creation of the National Council of Justice (CNJ) [33]. Given the complexity of the justice system and the lack of theories and methods that can fully explain its performance, there is a growing concern among society, lawmakers, and the justice system itself regarding issues related to judicial performance. Furthermore, studies aimed at understanding the factors that impact judicial performance have the prerogative of being inserted into this context of a still-emerging field, the Administration of Justice, lacking theories and methods that can satisfactorily explain a phenomenon as complex as the justice system.

Materials and Methods
This study adopts an exploratory quantitative approach and utilizes data from the National Council of Justice's Database of the National Judiciary Power, established by CNJ Resolution n. 331/2020 [34]. The report has been published since 2003 and represents the primary source of information and statistics concerning the Brazilian judiciary [23].
The study utilized variables related to productivity and expenses of the judiciary, based on observations of State Courts of Justice in 27 Brazilian states from September 2021. Considering that data and trends are not the same over time, given the possibility of variance in the productivity of certain branches of justice [35], the analysis focused on the last month available in the CNJ database.
After analyzing 1327 variables available in 27 observations, 16 were chosen for the study based on the literature mentioned in the text, including published judgments, filed lawsuits, instruction hearings, preliminary hearings, decisions, orders, sentences, 2nd degree commissioned positions, intern expenses, total asset personnel expenses (BRL), 1st degree asset personnel expenses (BRL), 2nd degree personnel asset expenses (R$), total workforce, magistrate productivity index, and server productivity index. The methodology involved standardizing the variables, creating models with the k-means algorithm, testing for data normality, and choosing the best grouping based on a paired t-test. A neural network model was then created to examine the main variables within each cluster [35].
The methodology involved the following steps: (1) standardization of the variables, (2) creation of models with 2, 3, and 4 clusters using the k-means algorithm, (3) normality test of the data, (4) selection of the best clustering approach by comparing the average productivity indices of the clusters formed using a paired Student's t-test, and (5) creation of a neural network model to identify the main variables within each cluster.
In this sense, it should be emphasized that the contribution of the present study is the combination of a deterministic and unsupervised mathematical technique (clustering) with a stochastic technique (neural networks) to evaluate the object of study. The theoretical contribution goes beyond this combination, including a new way of analyzing data from mathematical techniques that are not (normally) used in the field of study. Meanwhile, the present study innovates by using machine learning methods capable of predicting the studied phenomenon with high precision. The mathematical methods generally used to compare or indicate the number of clusters use variance only as a way to operationalize the internal processes of the technique, while the mathematical/statistical method used in this work seeks to compare the means of the characteristics of the clusters of the paired t method in pairs.

Standardization of Variables
The variables were standardized using the Z-score procedure, which involves subtracting the original variable's value from the mean and dividing it by the standard deviation [36]. This method is commonly used to standardize variables and eliminate the possible bias resulting from different scales of variables in the base [37].
It should be emphasized that the Z-score procedure served only to standardize the variables on the same scale, for comparison purposes. This choice is due to the fact that the data represent a photo from a specific period and not a video from a longer period of time, in other words, it is a clipping of a certain period of time.

Creation of Models with 2, 3, and 4 Clusters Using the k-Means Algorithm
The next step in the analysis was to apply the k-means algorithm, a non-hierarchical clustering method, to group the observations into 2, 3, and 4 clusters, based on the productivity of magistrates and servers of each court, to eliminate any subjective bias in the selection of clusters [37]. This algorithm automatically divides the observations into clusters in such a way as to minimize the sum of squares within the cluster.
As described by Hu et al. [38], the algorithm seeks to divide "n" observations into "k" classes (≤n) and obtain the mean of the points in each class, to calculate the sum of squares within the cluster, as shown in Equation (1) and in the following ones, where u i is the mean of the points in S i .
Next, the term u i is used as the center of the cluster to measure the new distance, which is gradually optimized through interactions. This means that the algorithm proceeds by minimizing the sum of squared deviations within each cluster, as shown in Equation (2).
Finally, the equivalence was calculated from the identity offered by Equation (3).
The models were systematically created with an incremental number of clusters, starting with 2 clusters, and eventually reaching a total of 4 clusters. The productivity averages for each cluster were then analyzed to determine whether there was a statistically significant difference within each model.

Creating a General Productivity Index
To compare the average productivity of the models formed with 2, 3, and 4 clusters, we summed up the productivity index of magistrates with the productivity index of public servants to form a single general productivity index, which allowed for the average test.

Normality Test of the Data
To determine whether the variables in each cluster followed a Gaussian distribution, it was necessary to choose between parametric or non-parametric methods for comparing the means. The data's normality was assessed using the Kolmogorov-Smirnov (KS) and Shapiro-Francia (SF) tests. In both tests, the null hypothesis (H0) is that the data adheres to a normal distribution, and the alternative hypothesis (H1) is that it does not adhere to a normal distribution. A significance level of 5% and a confidence level of 95% were used. For this study, the KS test was deemed more appropriate for large samples, while the SF test was more appropriate for small samples, based on the following hypotheses [37]: H0. The sample has a normal distribution. G(x 1 ) is the cumulative empirical function, and G(x i ) is the expected function [39].
To determine whether parametric or non-parametric methods were necessary for comparing the means, it was necessary to verify the normality of the data distribution. The normality tests were conducted to determine whether there were differences in the productivity averages in the models with 2, 3, and 4 clusters.
The purpose of the clustering is to classify the Regional Courts of Justice in the Brazilian context, a country with continental dimensions and with a marked heterogeneity among all regions and, consequently, among the institutions in each region, according to their productivity, reducing the level of subjectivity in choosing the amount of the grouping, based on mathematical methods that compare the averages for each model. From this difference in means, the number of clusters were chosen, and different levels of productivity were revealed. It is also necessary to emphasize that the variables used to classify the clusters were only related to productivity, therefore it was not possible to capture other aspects.

Selection of the Best Clustering Approach (2, 3, or 4 Clusters)
The productivity averages in the models with 2, 3, and 4 clusters were tested using the paired sample t-test, after verifying the normality of the data for each cluster formed in the first stage. The test aimed to determine whether there were significant differences in productivity means between the clusters considered pairwise, with a 5% significance level and a 95% confidence level. The paired sample t-test is a parametric test that compares the means of two related samples with the following hypotheses [41]: H0. The sample means are equal.

H1. The sample means are different.
In order to test the difference in productivity means between the clusters reciprocally considered, the parametric test known as Student's t-test for paired samples was performed. The formula for this test, as described by Fralick [42], is shown below, where . X d is the difference between the mean values of the samples, and X jl corresponds to the observation: To use Student's t-test, certain requirements must be met, which were observed in this work. These include at least two means for comparison, data with an interval nature, random or exhaustive sampling over a certain period, samples with the same variance, and normal distribution [37]. After verifying the differences in the averages of the groups formed in the model with four clusters, the study rejected the null hypothesis H0 in the paired sample t-test. Thus, multivariate statistical models were assembled to determine which variables could explain the difference in average productivity among each cluster in the model above.

Neural Network Model
Neural networks were created for each cluster to identify the variables that could explain each cluster's average productivity difference. Neural networks are models composed of units called neurons, which have nonlinear activation functions, such as sigmoid and hyperbolic functions, to infer arbitrary nonlinear relationships from complex input layers connected to output layers and hidden layers. The model parameters are the synaptic weights between neurons, which are adjusted by a stochastic interactive algorithm capable of learning through examples and generalizing information in complex environments [43]. Neural networks aim to imitate the functioning of the human brain through learning and generalization processes [44]. Figure 1 shows a graphical representation of a neural network. It is important to note that this study used neural networks to identify which variables were significantly relevant in explaining the difference in average productivity for each cluster formed. random or exhaustive sampling over a certain period, samples with the same variance, and normal distribution [37]. After verifying the differences in the averages of the groups formed in the model with four clusters, the study rejected the null hypothesis H0 in the paired sample t-test. Thus, multivariate statistical models were assembled to determine which variables could explain the difference in average productivity among each cluster in the model above.

Neural Network Model
Neural networks were created for each cluster to identify the variables that could explain each cluster's average productivity difference. Neural networks are models composed of units called neurons, which have nonlinear activation functions, such as sigmoid and hyperbolic functions, to infer arbitrary nonlinear relationships from complex input layers connected to output layers and hidden layers. The model parameters are the synaptic weights between neurons, which are adjusted by a stochastic interactive algorithm capable of learning through examples and generalizing information in complex environments [43]. Neural networks aim to imitate the functioning of the human brain through learning and generalization processes [44]. Figure 1 shows a graphical representation of a neural network. It is important to note that this study used neural networks to identify which variables were significantly relevant in explaining the difference in average productivity for each cluster formed. A neuron generates a Y output called a synapse, which results from the combination of inputs (X1, X2, ..., Xn), and serves as an input for other neurons. The Y output results from an activation function, such as a sigmoid, hyperbolic, etc., and each output has a weight (W1, W2, ..., Wn). By continuously adjusting the relevance of the synapses (Wn weight values), the artificial neural network can learn pa erns and generalize its results [45].
The activation function that returned the best results in this study was the hyperbolic tangent in the hidden layers and the pa erned identity in the output layers. In the input layers, the variables were rescaled based on their normalization. Before that, Pearson's parametric correlation test was performed, considering the normality of the data [46], for comparison purposes with the results of the neural network models. From the assembly of these models, those with the best accuracy and ability to provide analyses capable of answering the research problem, related to measuring productivity as a function of spending within the judiciary, were chosen. A neuron generates a Y output called a synapse, which results from the combination of inputs (X 1 , X 2 , ..., X n ), and serves as an input for other neurons. The Y output results from an activation function, such as a sigmoid, hyperbolic, etc., and each output has a weight (W 1 , W 2 , ..., W n ). By continuously adjusting the relevance of the synapses (W n weight values), the artificial neural network can learn patterns and generalize its results [45].
The activation function that returned the best results in this study was the hyperbolic tangent in the hidden layers and the patterned identity in the output layers. In the input layers, the variables were rescaled based on their normalization. Before that, Pearson's parametric correlation test was performed, considering the normality of the data [46], for comparison purposes with the results of the neural network models. From the assembly of these models, those with the best accuracy and ability to provide analyses capable of answering the research problem, related to measuring productivity as a function of spending within the judiciary, were chosen.
The use of the neural network technique in this article is justified due to the fact that the technique allows more accurate models to be obtained, capable of providing more robust analyzes to respond to the research problem related to the measurement of productivity as a function of expenditures within the scope of the judiciary.

Results
To establish the model, we identified 16 relevant variables from the National Judiciary Database, consisting of 1327 variables selected from the database established by CNJ Resolution n. 331/2020 of the National Council of Justice: total spending (BRL), published judgments, filed lawsuits, instruction hearings, preliminary hearings, decisions, orders, sentences, second degree commissioned positions, intern expenses, total personnel asset expenses (BRL), first degree personnel asset expenses (BRL), second degree personnel asset expenses (BRL), total workforce, magistrate productivity index, and server productivity index.
Descriptive data analysis was performed to assess the basic characteristics of each variable, including their amplitude, average, and standard deviations. Table 2 presents the results of this analysis.
A brief analysis reveals that the sample displays wide-ranging values for each variable. For instance, total spending ranges from around BRL 4,859,285,529.56 (state of Roraima) to BRL 247,818,421,938.83 (state of São Paulo), indicating significant regional differences in public spending on the judiciary. This implies that the Courts of Justice in different regions of the country vary widely in their expenditure, which may affect their management. Similarly, examining the magistrates productivity index, the lowest values range from 557.8 (state of Amapá) to 3723.59 (state of Rio de Janeiro), while the minimum server productivity index varies from 36.26 (state of Amapá) to 225.90 (state of Rio Grande do Norte). Therefore, regional differences extend beyond spending and affect the productivity of each court, the focus of this study. Moreover, the court workforce is highly dispersed, with a mean of 10,916.15 and a much higher standard deviation of 13,362.53. The smallest Court of Justice has only 1373 servants (state of Roraima), while the largest has more than 67,799 employees (state of São Paulo), further highlighting the considerable variation in the size of each court. The concept used in this study is the same as the one used by the regulatory agency for the administrative activity of the Brazilian judiciary, which defines productivity as the ratio between the volume of cases disposed and the number of magistrates (ipm) and servers (ips) who worked during the month in the jurisdiction.
Therefore, based on a brief analysis of the data, it can be concluded that the national judiciary is highly heterogeneous, with courts of varying characteristics and sizes [47]. Furthermore, productivity levels vary greatly and are dispersed for each judicial unit. Further investigation is needed to identify the main factors affecting performance, particularly concerning public spending.

Application of Machine Learning
To address the research question of grouping similar courts based on their productivity, we utilized the k-means algorithm to perform non-hierarchical clustering of each organ into internally homogeneous and externally heterogeneous groups [37] based on the productivity of the magistrates and servants. After testing with different numbers of groups, we found it necessary to remove the judiciary of the state of São Paulo, as its inclusion made the classification of the other courts quite discrepant. The São Paulo Court of Justice has a budget and number of employees nearly three times greater than the second-largest judiciary, the Judiciary Power of the state of Minas Gerais, indicating its size and unique characteristics. It is also the largest court in the world in terms of the volume of cases received and processed, accounting for approximately 25% of the total number of ongoing lawsuits in all of Brazilian justice [13]. The results from the clustering model can be seen in Figure 2, where four groups were formed: judiciary is highly heterogeneous, with courts of varying characteristics and sizes [47]. Furthermore, productivity levels vary greatly and are dispersed for each judicial unit. Further investigation is needed to identify the main factors affecting performance, particularly concerning public spending.

Application of Machine Learning
To address the research question of grouping similar courts based on their productivity, we utilized the k-means algorithm to perform non-hierarchical clustering of each organ into internally homogeneous and externally heterogeneous groups [37] based on the productivity of the magistrates and servants. After testing with different numbers of groups, we found it necessary to remove the judiciary of the state of São Paulo, as its inclusion made the classification of the other courts quite discrepant. The São Paulo Court of Justice has a budget and number of employees nearly three times greater than the second-largest judiciary, the Judiciary Power of the state of Minas Gerais, indicating its size and unique characteristics. It is also the largest court in the world in terms of the volume of cases received and processed, accounting for approximately 25% of the total number of ongoing lawsuits in all of Brazilian justice [13]. The results from the clustering model can be seen in Figure 2, where four groups were formed: A combined magistrates' and civil servants' productivity index was calculated for each cluster to determine whether there was a statistically significant difference in productivity between the four groups of courts. This method has been previously used in similar studies, such as Renosto et al. [48]. Before comparing the means of each cluster, we needed to confirm whether the productivity data followed a normal Gaussian distribution, as both A combined magistrates' and civil servants' productivity index was calculated for each cluster to determine whether there was a statistically significant difference in productivity between the four groups of courts. This method has been previously used in similar studies, such as Renosto et al. [48]. Before comparing the means of each cluster, we needed to confirm whether the productivity data followed a normal Gaussian distribution, as both parametric and non-parametric tests require this assumption. Table 3 shows the clusters and their respective components. The data in Table 4 were analyzed using both the Kolmogorov-Smirnov (KS) test and the Shapiro-Francia (SF) test, which found that the data followed a normal distribution at a 95% confidence level with a 5% margin of error. It should be noted that the previous tests also indicated normality when the null hypothesis was not rejected, meaning that the p-value was greater than the assumed significance level of 0.05 [37]. However, only the KS test yielded a statistically significant result among the tests conducted. Nonetheless, this was sufficient to demonstrate the normality of the data being investigated. After confirming the normality of the data in each of the four clusters, we conducted a parametric test called Student's t-test on paired samples to compare the productivity means between each pair of clusters [49]. Table 5 shows the results of Student's t-test conducted on the pairwise paired samples. The test revealed statistically significant differences in the productivity indices means between the clusters, with p-values less than 0.05 for all the tests carried out, at a confidence level of 95%. This indicates that there were significant differences in productivity among the clusters. We conducted a Pearson's bivariate correlation analysis between four variables: total workforce (ftt), total personnel asset expenses (dpea), total productivity, and total expenditure, using internal data from each group to observe the behavior of each variable relative to its peers. Pearson's correlation test was chosen as a parametric test considering the normality of the data tested above [46].
Pearson's correlation measures the linear relationship between two variables, where a change in one variable corresponds to a change in the other variable [50]. Correlation values range from −1 (negative correlation) to +1 (positive correlation) and indicate the strength and direction of the linear relationship between two continuous variables [46]. Table 6 shows that the judiciary's total expenditure is not significantly related to the productivity of judges and civil servants in any of the formed clusters, indicating that budgetary expenditure alone is insufficient to differentiate productivity among the clusters. There are probably other variables capable of differentiating productivity in each group.
The total expenditure is highly correlated with the workforce and expenditure on active personnel in all groups, indicating that most expenditure is directed toward increasing human resources. However, increasing the expenditure alone does not decisively influence productivity. Based on these findings, multivariate statistical models were used to analyze the characteristics of each cluster and identify which variables had the greatest influence on productivity indices. * The correlation is significant at the 0.05 level; ** the correlation is significant at the 0.01 level.

Neural Networks
In order to measure the total productivity index based on the input variables, namely the total expenditure, active personnel expenditure (dpea), total workforce (ftt), magistrates' productivity index (ipm), and servers' productivity index (ips), neural networks were trained using IBM SPSS Statistics software, version 22, for each of the clusters formed. The multilayer perceptron neural network, with standardized variables and only one hidden layer, was employed for this purpose. Table 7 presents the percentage of the training and testing sample for each of the neural networks used.  To clarify, in the multilayer perceptron neural networks trained using IBM SPSS Statistics software version 22, the system establishes the training and test sample parameters and selects the best database partition for simulation. Table 8 shows the parameters for each model used for the groups, including five units in the input layers, the rescaling of the input and output variables normalized for all models, the hyperbolic tangent activation function for the hidden layers, and the identity function for the output layer. The hyperbolic tangent function transforms real values within the interval of −1 and 1, while the identity function returns identical values from real values [51]. All groups had only one hidden layer, with Groups 2 and 4 having three units in the hidden layers and Group 2 having only two units in the hidden layer. Table 9 shows the summary of the model based on the sum of the squared errors and the relative error, with the total productivity of each of the clusters formed in the previous step as the dependent variable. The model training time was fast, considering the small amplitude of the database used.
Upon reviewing the results from the models, particularly the sum of the squared errors and the relative error, we found that both the training and test samples showed only slight deviations from the predicted values when compared to the observable ones. Therefore, the neural networks demonstrate an effective means of predicting the dependent variable. Figures 3-5 inform the synaptic weights between the neurons and the trained models for each group formed in the clustering step. Each synaptic weighting is a connecting link characterized by its strength or weight, with more prominent values indicating a greater degree of importance for predicting the dependent variable [52]. Synaptic weights reveal relationships between variables in one layer with variables arranged in the next layer.
the identity function returns identical values from real values [51]. All groups had only one hidden layer, with Groups 2 and 4 having three units in the hidden layers and Group 2 having only two units in the hidden layer.  Table 9 shows the summary of the model based on the sum of the squared errors and the relative error, with the total productivity of each of the clusters formed in the previous step as the dependent variable. The model training time was fast, considering the small amplitude of the database used. Upon reviewing the results from the models, particularly the sum of the squared errors and the relative error, we found that both the training and test samples showed only slight deviations from the predicted values when compared to the observable ones. Therefore, the neural networks demonstrate an effective means of predicting the dependent variable. Figures 3-5 inform the synaptic weights between the neurons and the trained models for each group formed in the clustering step. Each synaptic weighting is a connecting link characterized by its strength or weight, with more prominent values indicating a greater degree of importance for predicting the dependent variable [52]. Synaptic weights reveal relationships between variables in one layer with variables arranged in the next layer.    It is observed that the productivity indices for judges and civil servants have synaptic weights below zero, and the expense with active civil servants in all models also has negative synaptic weightings in part of the models, as highlighted in all neural network simulations. We can see the artificial neural networks for each group formed in Table 10.     It is observed that the productivity indices for judges and civil servants have synaptic weights below zero, and the expense with active civil servants in all models also has negative synaptic weightings in part of the models, as highlighted in all neural network simulations. We can see the artificial neural networks for each group formed in Table 10.  It is observed that the productivity indices for judges and civil servants have synaptic weights below zero, and the expense with active civil servants in all models also has negative synaptic weightings in part of the models, as highlighted in all neural network simulations. We can see the artificial neural networks for each group formed in Table 10. The importance of each variable for the simulated neural network model is shown in Figure 6. The expenditure itself is not the most important variable to guarantee the productivity of any groups formed. The importance of each variable for the simulated neural network model is shown in Figure 6. The expenditure itself is not the most important variable to guarantee the productivity of any groups formed.

Discussion
The judiciary in Brazil faces the growing demand for lawsuits, which has not been matched by an equivalent increase in the judiciary's response capacity [14,53]. This situation, known as the "explosion of litigiousness", threatens the credibility of the judiciary and the quality of Brazilian democracy [3]. To address this issue, this work aimed to contribute to the understanding on the productivity of the judiciary, a field that has received little attention in Public Administration and Law. Specifically, we examined the relationships between variables related to judicial performance and the judiciary's budget.
Our analysis, using neural networks, supports the findings of Pearson's parametric correlation test, which showed that increased spending is not related to increased productivity. The final model demonstrates that expenditure is not a significant factor in predicting productivity. This result challenges the assumption that more resources lead to better performance by the judiciary.
The study found that variables related to the productivity index of civil servants and magistrates are more important in increasing total productivity than public budgetary expenditure. This conclusion was reached after conducting a cluster analysis and training a neural network model that effectively predicted the dependent variable. The research demonstrates that increasing public budgetary expenditure alone is insufficient to improve the efficiency of the judiciary, highlighting the need for other administrative and technical measures. Thus, the study significantly contributes to the theoretical and managerial understanding in this area.
Additionally, it is important to consider the nature of litigation in Brazil. Mays and Taggart [54] identified three categories of commonly cited causes of delay: external sociopolitical pressures, external legal changes, and internal behavioral factors. The authors argued that ineffective jurisdictional provision is a significant issue. In the case of Brazil, the number of lawsuits has grown much faster than the population since the Federal Constitution of 1988, indicating an exceptional degree of litigiousness. This trend emphasizes the need for effective measures to enhance service rates in response to the demands of the Brazilian judiciary [53]. According to data from the 2021 Justice in Numbers Report, on average, for each group of 100,000 inhabitants, 10,675 people filed a lawsuit in 2020 (CNJ, 2021).
To promote innovation and effective analysis in the Brazilian judiciary, there is a significant need for a research agenda focusing on the quantitative analysis of court efficiency, particularly regarding congestion and its associated variables [35]. This type of study is essential, since the Brazilian judiciary has historically been resistant to change and significant innovations [3]). While increasing resources in the judiciary, such as salaries and court numbers, may improve its operation [55], empirical and scientifically proven studies are necessary to direct investments effectively.
This study has some limitations that should be considered. Firstly, it focuses solely on one aspect of the judiciary, public budgetary expenditure, without considering other relevant factors that may impact efficiency, such as the number of judges, workload, the quality of the legal system, and the political and social context. As a result, the results may not fully capture the complexity of the problem and may not be applicable to other countries or contexts. Additionally, the research design relies on cross-sectional data, which restricts the ability to establish causal relationships between the variables.
It is suggested that future research should consider administrative and human resource management variables, applying the methodology presented in this study to other branches of justice or using other machine learning models. Additionally, studies are suggested to investigate how different judicial units allocate and use their resources and how this translates into greater efficiency in providing services to the jurisdiction. Furthermore, it is recommended to conduct future investigations that can help understand the indirect relationships between the constructs listed in this study. The public service budget, which is largely spent on the payment of civil servants, may be directly or indirectly related to other factors, and statistical mediation or moderation techniques can provide a better understanding of these relationships.
However, according to Procopiuck [56], managerial and technological strategies that directly impact judicial processes do not fully capture the complexity of judicial performance and, therefore, cannot be used in isolation to explain this phenomenon. Other factors, such as legislation stipulating deadlines and the number of funds admitted, must also be considered. Despite the challenges inherent in studying judicial performance, it is important to acknowledge and address them to promote meaningful research [23].
Finally, we can consider the effectiveness of the law and the jurisdictional function of the state as elements of social transformation. After all, a right that does not intervene in the reality for which it was established cannot be effective. There is no use in creating an infinity of laws, codes, regulations, and different norms if this law does not have the capacity to influence the real world, regulating the relations for which it was created. And for this to happen, the judiciary needs to play its fundamental role: to judge. Judge in a reasonable time, effectively, and fairly. After all, the law, and consequently the right, cannot be a mere sheet of paper.