October 26, 2026
Application of “machine learning” in the forecast of Goiás’s Primary Expense
Raphael Maciel de Lima; Nuno Manoel Martins Dias Fouto
DOI: 10.22167/2675-6528-202603385
Article derived from a Course Conclusion Work (TCC), with content based on the student’s original work and adapted to the editorial format of the E&S Magazine with the support of the ResumeAI tool, an artificial intelligence solution developed by Instituto Pecege for textual synthesis and organization.
Summary
This study addressed the challenge of forecasting primary public expenditures in the State of Goiás, in a scenario of fiscal regime transition that imposed structural breaks in historical series. The general objective was to develop and validate a forecasting methodology for Goiana’s primary expenditure, capable of predicting structural breaks and complex seasonalities. To this end, a hybrid modeling approach was used, combining exponential smoothing (ETS) with machine learning algorithms (Ridge Regression). Formal detection of structural breaks was confirmed by the Chow Test (p < 0.01), justifying the integration of lagged exogenous variables. The evaluation of predictive performance, carried out using the rolling windows technique, demonstrated the superiority of the hybrid approach, which reduced the Mean Absolute Percentage Error (MAPE) from 6.36% (SARIMA) to 6.02%. The hybrid model showed a smaller discrepancy in the accumulated second half of 2025, with an error of 1.08%. Additionally, a sensitivity analysis was performed for the fiscal year 2026, simulating fiscal adjustment scenarios, which revealed a progressive but limited saving, due to the rigidity of mandatory expenses. It was concluded that the hybrid predictive approach was effective in simulating fiscal scenarios under the new spending cap guidelines, highlighting the importance of robust models for dynamic fiscal environments and the challenges imposed by budgetary rigidity.
Keywords: fiscal management; hybrid models; “Ridge” regression; spending cap.
1. Introduction
Fiscal management is a topic of broad discussion due to its social complexity and relevance to the balance of public accounts. The quality of fiscal management is often evaluated by analyzing the budgetary result and the primary result. The Manual of Accounting Applied to the Public Sector (BRASIL, 2024) defines the primary result as the difference between non-financial revenues and expenses, such as taxes, contributions, and transfers, excluding financial items. The budgetary result, in turn, encompasses all revenues and expenses incurred during the fiscal year, including those of a financial nature.
The Federal Constitution (1988), in its article 165, establishes that the Executive Branch must prepare instruments for planning revenues and expenses in the short, medium, and long term, such as the Pluriannual Plan, the Budgetary Guidelines Law, and the Annual Budget Law. To this end, it is essential that the Union, states, and municipalities develop accurate forecasts and estimates. Revenue forecasting, for example, is intrinsically linked to macroeconomic variables, such as Gross Domestic Product and inflation, being addressed by fiscal projections from the National Treasury Secretariat (BRASIL, 2025) and by academic studies that use time series models, such as Lemos (2023) for tax collection.
However, expense forecasting presents distinct challenges. The State of Goiás, in the last decade, has faced successive changes in its Fiscal Framework, impacting the predictability of spending. In 2021, budget execution was limited by the spending limits established by Federal Complementary Law nº 156/2016. Subsequently, in 2022, the state joined the Fiscal Recovery Regime (RRF), regulated by Complementary Law nº 159/2017, which imposed strict prohibitions and spending control rules as a counterpart to the renegotiation of liabilities.
This scenario, however, changed in 2025 with the approval of Complementary Law No. 212/2025, which established the Fiscal Monitoring and Transparency Program (Propag). Propag offered more flexible fiscal balance conditions, leading the Government of Goiás to opt for the early termination of the RRF to join the new program. This normative transition resulted in a temporary flexibilization in 2025, with a significant increase in expenses, especially in investments. Statistically, this event generated a “shock” in the historical series, characterizing a structural break that challenges the linearity of traditional projection models. For the fiscal year 2026, Propag’s governance rules impose a return to spending cap restrictions.
The estimation of primary expenditure for 2026, therefore, is a complex process. Expenditure dynamics differ from revenue by involving institutional, political, and administrative factors, adding uncertainty and requiring advanced analytical tools. In contexts of fiscal regime changes, the hypothesis of structural stability implicit in classic univariate models becomes questionable, compromising the predictive capacity of approaches based solely on the inertia of historical series. Empirical evidence, such as that from the M4 competition (Makridakis et al., 2018) and previous studies (Ahmed et al., 2010), demonstrates that pure machine learning methods can perform worse compared to traditional statistical approaches or model combinations.
In this sense, the literature points to the superiority of hybrid methods, which integrate statistical and machine learning approaches, as demonstrated by Smyl (2020), to enhance predictive accuracy in complex time series. The combination of these techniques offers a more robust path to capture the inertia of mandatory spending and the volatility of discretionary decisions in new control regimes. Given the need for more accurate and resilient predictive tools for structural breaks and complex seasonalities, the general objective of this work was to develop and validate a forecasting methodology for the primary expenditure of the State of Goiás capable of predicting structural breaks and complex seasonalities.
2. Material and Methods
This study was characterized as a quantitative and applied research, based on the modeling of financial time series, according to approaches by Brooks (2019) and Tsay (2010). The general objective was to develop and validate a forecasting methodology for the primary expenditure of the State of Goiás, focusing on the ability to predict structural breaks and complex seasonalities. The unit of analysis consisted of the primary expenditure data of the State of Goiás.
The adopted methodology was structured in five main stages. Initially, data collection and preprocessing were carried out. Next, structural break testing was performed to identify significant changes in the time series. The third stage involved training econometric and machine learning models. Subsequently, analytical adjustments were made to capture the impact of the scenario of returning to the spending cap. Finally, future scenarios for the expenditure of the State of Goiás were simulated.
Data collection was carried out through the Business Object (BO) system of the Secretariat of State for Economy of Goiás. The analysis period covered 72 monthly observations, from January 2020 to December 2025. This temporal delimitation was established to ensure the standardization and consistency of the extraction routines for commitment, liquidation, and payment records, as well as to provide robust statistical density for the identification of seasonal patterns and recent trends in fiscal management.
In the pre-processing stage, the original expense values were converted to the unit of millions of reais (R$Mi) to facilitate the calculation processing by the models. Lagged variables, known as “lags”, were created by applying one to three-month delays to the commitment and settlement variables. Additionally, auxiliary “dummy” variables were included to capture seasonal patterns that repeat throughout the year.
To validate the hypothesis of structural break in the time series, the Chow Test (Chow, 1960; Wooldridge, 2010) was used to verify the existence of breaks in linear regression models. Complementarily, the CUSUM test (Browm et al., 1975) was applied to assess the stability of parameters over time. Both tests were executed in the R programming language, with the support of the specialized package strucchange, aiming to formally detect changes in the dynamics of expenses from 2025 onwards.
Regarding modeling, the study adopted two main approaches for comparative purposes. The first was based on classical statistics, with the application of Auto-Regressive Integrated Moving Average (ARIMA/SARIMA) and Error, Trend, Seasonality (ETS) models. The second approach was based on machine learning techniques, through a hybrid architecture that combined the exponential smoothing of the ETS model with “Ridge” Regression.
In the hybrid model, the “Ridge” algorithm was employed to model the residuals from the statistical approach (ETS), using lagged values of commitment and settlement as explanatory variables. The choice of “Ridge” regularization was justified by its efficiency in handling the multicollinearity inherent in fiscal variables, contributing to the stability of projections and preserving all explanatory variables, promoting the shrinkage of their coefficients (Izbicki; Santos, 2020).
Data processing and statistical modeling were performed in the Python programming language. For the manipulation and structuring of time series, the Pandas library was used. The implementation of classic econometric models and stationarity tests was enabled by the Statsmodels library. For the development of supervised machine learning algorithms, Scikit-Learn was employed. Graphical visualization and exploratory analysis were built with the support of the Matplotlib library.
To evaluate the models’ generalization capacity and measure predictive performance, the “Rolling Origin” technique was used, as proposed by Hyndman and Athanasopoulos (2018). This approach consisted of updating the training set as new observations became available, simulating the monthly forecasting process. The error metrics used for comparison were the Mean Absolute Error (MAE), the Root Mean Squared Error (RMSE), and the Mean Absolute Percentage Error (MAPE).
After defining the best-performing model, expenses were projected for the fiscal year 2026. Given the imposition of spending cap restrictions for 2026, a sensitivity analysis was implemented. Scenarios of discretionary expense compression were simulated, applying gradual reducers to the commitment flow by 5%, 10%, and 15%, based on the State’s historical fiscal adjustments.
3. Results and Discussion
The analysis of the primary expenditure of the State of Goiás revealed a complex dynamic, marked by structural breaks and the need for robust predictive models. The results obtained confirmed the hypothesis of instability in the historical series, especially from 2025 onwards, a period of transition of fiscal regimes. The hybrid methodology developed demonstrated superior capacity in expenditure forecasting, surpassing traditional statistical models and offering a more precise tool for fiscal management in uncertain scenarios.
Structural Break Detection
The investigation of the stability of the payment series was initiated with the application of the Chow test, which sought to identify the existence of a structural break starting in January 2025. The results indicated an F-statistic of 4.959 and a p-value of 0.009764, allowing the rejection of the null hypothesis of structural stability at a 5% significance level. This statistical evidence confirmed a significant change in the dynamics of the expenditure series, validating the occurrence of a structural break in the analyzed period, according to the literature on structural break tests (Chow, 1960; Wooldridge, 2010).
To characterize the nature of this break, a regression model was estimated, incorporating a “dummy” variable for the period after 2025 and an interaction term with the temporal trend. A negative coefficient was observed associated with the “dummy”, indicating an expressive reduction in the series level at the time of the break. However, simultaneously, a significant increase in the trend’s slope was verified after the break, suggesting that, despite the initial abrupt drop in payments, the series adopted a faster growth rate, signaling the transition to a new regime of fiscal behavior.
Complementarily, the CUSUM test was applied to evaluate the stability of the parameters over time, following the approach of Browm et al. (1975). The cumulative sum of residuals trajectory remained consistently within the critical bands throughout the entire analysis period, which did not indicate persistent structural instability. This finding, together with the results of the Chow test, suggests that the identified break was of a punctual nature, being associated with a specific shock that occurred in 2025, and was followed by a new behavioral pattern that proved to be relatively stable over time.
Predictive Performance Evaluation of the Models
The evaluation of the predictive performance of the models was carried out using the rolling window validation technique, a predictive approach that allows for a robust analysis of the models’ generalization capability against historical series fluctuations. The consolidated results for the 2025 fiscal year, specifically between July and December, positioned the Hybrid model (ETS + Ridge) as the best performing. This model presented the lowest Mean Absolute Percentage Error (MAPE) of 6.02%, outperforming the isolated ETS model, which registered 6.30%, and the SARIMA model, with 8.64%.
Beyond the superiority in terms of percentage error, the hybrid model demonstrated greater accuracy by presenting the lowest values for Mean Absolute Error (MAE) and Root Mean Squared Error (RMSE). The MAE of the hybrid model was R$251.28 million, while the ETS registered R$261.24 million and the SARIMA, R$382.10 million. The RMSE of the hybrid model was R$304.02 million, compared to R$306.81 million for the ETS and R$425.19 million for the SARIMA. The lower RMSE of the hybrid model is particularly relevant, as it penalizes larger magnitude errors, indicating that the hybrid approach is more stable and less susceptible to extreme deviations compared to traditional models.
The comparison between the actual values realized and the predictions generated by the three models for the second half of 2025 highlighted the characteristic volatility of the payment series of the State of Goiás, especially in the last quarter of the year. The Hybrid model (ETS + Ridge) demonstrated the best adherence to the real series, capturing the observed fluctuations more effectively. In contrast, the ETS and SARIMA models showed a tendency to underestimate in August and September, which emphasizes the greater sensitivity of the hybrid model to the dynamic behavior of expenditure.
In the cumulative second semester of 2025, primary expenditure totaled R$ 26.00 billion. The Hybrid Ridge model presented the smallest discrepancy in this period, with a cumulative error of only 1.08%. In contrast, the ETS and SARIMA models underestimated the total by 2.19% and 8.29%, respectively. This superior performance of the hybrid model validates the integration of lagged commitment and settlement variables, which proved fundamental in capturing the temporal inertia of public expenditure, contributing to predictive accuracy in a scenario of structural breaks and complex seasonalities.
Projection and Sensitivity Analysis for 2026
With the hybrid model validated, the primary expenditure for the year 2026 was projected. To estimate the impact of the return to spending cap restrictions, as foreseen in the Fiscal Transparency and Monitoring Program (Propag), a sensitivity analysis was performed. This analysis involved the introduction of gradual reducers on the commitment flow, with percentages of 5%, 10%, and 15%, allowing for the simulation of different fiscal adjustment intensities and testing the model’s responsiveness to discretionary changes in budget execution.
The use of “Ridge” regression for residual correction ensured the system’s monotonicity, as the inherent regularization of this method reduces the model’s sensitivity to spurious collinearities (Izbicki; Santos, 2020). This attribute was crucial to guarantee that the algorithm preserved the logical integrity between the expense phases, mitigating predictive inconsistencies and preventing the payment projection from exceeding the limits imposed by liquidation or commitment. The consolidated results for the different scenarios of 2026 were detailed, revealing the impact of fiscal adjustments.
The results demonstrated that the application of reductions on the commitment generated a progressive economy in the final financial disbursement. However, this relationship did not prove to be perfectly linear, due to the rigidity of mandatory expenses captured by the ETS component of the model. In the scenario of a 15% adjustment in discretionary expenses, the projected savings compared to the inertial scenario reached approximately 185.84 million reais annually. The generated savings manifested progressively throughout the year, indicating that the cuts, although effective, are limited by the budgetary structure.
The low sensitivity of the cut percentage to the variation in total disbursement highlighted the structural rigidity of the State of Goiás’ budget. Reductions in spending limits did not translate, in the same proportion, into effective decreases in the disbursed volume. This behavior is intrinsically associated with the high degree of budgetary earmarking, where a significant portion of expenses consists of legal and constitutional obligations. Examples include the minimum mandatory spending on health and education, which have constitutionally linked revenue percentages, as well as personnel expenses, such as salaries, pensions, and social charges, governed by specific legal norms.
As a result, such expenditures exhibited an inertial character, which reduced the capacity for discretionary adjustment in the short term and limited the effectiveness of fiscal containment measures. A large portion of the budget is already pre-committed, posing significant challenges to fiscal management in a spending cap environment. The sensitivity analysis demonstrated that, even with substantial cuts in discretionary spending, the impact on the annual total is modest due to the preponderance of mandatory expenditures.
Exploratory Analysis for Investment Expenses (GND 4)
As an additional exploratory analysis, the model was specifically applied to Expenditure Nature Group 4 (GND 4), which encompasses Investments. This category is recognized for its greater discretion and volatility, making it a particular challenge for forecasting. Traditional models, such as SARIMA, showed a high Mean Absolute Percentage Error (MAPE) of 22.43% for this category, reflecting the difficulty in capturing its dynamics.
In contrast, the hybrid approach demonstrated greater resilience, reducing the error to 14.49% in GND 4. In the simulation of scenarios for 2026, it was observed that GND 4 presents a direct sensitivity to fiscal adjustments, where a 15% cut in commitments resulted in projected savings of 30.5 million reais. This exercise demonstrated that the developed tool is capable of capturing the particularities of distinct expense groups, allowing for more granular and targeted planning to the items subject to adjustment, despite the main analysis having focused on global expense aggregates.
In summary, the hybrid predictive methodology developed was effective in simulating fiscal scenarios under the new spending cap guidelines in the State of Goiás. The confirmation of the structural break in 2025 and the superiority of the hybrid model in terms of predictive accuracy, with a MAPE of 6.02% and an accumulated error of 1.08% in the second half of 2025, highlight the importance of robust models for dynamic fiscal environments. The sensitivity analysis for 2026, in turn, revealed the challenges imposed by budgetary rigidity, emphasizing the limited capacity for discretionary adjustment in the face of the preponderance of mandatory expenses, which directly addresses the objective of developing a methodology capable of predicting structural breaks and complex seasonalities.
4. Conclusion
The present study sought to develop and validate a forecasting methodology for the primary expenditure of the State of Goiás, capable of predicting structural breaks and complex seasonalities in a scenario of fiscal regime transition. Through the Chow Test, a significant structural break was verified in the historical payment series starting from 2025, which justified the application of a more robust predictive approach. The hybrid methodology, which combined exponential smoothing (ETS) with Ridge regression, demonstrated superior performance compared to traditional statistical models, such as SARIMA, by reducing the Mean Absolute Percentage Error (MAPE) to 6.02%. Furthermore, a remarkable adherence of the hybrid model to the realized values in the second half of 2025 was observed, with an accumulated error of only 1.08%, evidencing the effectiveness of integrating exogenous variables lagged by commitment and settlement, and rolling window validation to capture the temporal inertia of public expenditure. The main contribution of this work lies in offering a more accurate and resilient analytical tool for fiscal management, allowing for scenario simulation under the new spending cap guidelines.
The sensitivity analysis for the 2026 fiscal year, which simulated fiscal adjustment scenarios, revealed a progressive, yet limited, economy in the final financial disbursement. This finding highlighted the structural rigidity of the Goiano budget, where the preponderance of mandatory expenses, such as health, education, and personnel costs, restricts the capacity for discretionary adjustment and the effectiveness of fiscal containment measures. As a limitation, the research focused on global expenditure aggregates, without discriminating the particularities of each government agency or function. It is suggested, for future studies, to apply the methodology to more specific expenditure groups or disaggregated data, which could enhance the planning and resource allocation capacity at more granular levels of public administration.
Bibliographic References
Ahmed et al., 2010 [Referência completa não encontrada no documento original]
Brasil. 1988. Constituição da República Federativa do Brasil de 1988. Brasília, DF: Presidência da República. Disponível em: http://www.planalto.gov.br/ccivil_03/constituicao/constituicao.htm. Acesso em: 21 abril. 2026.
Brasil. Secretaria do Tesouro Nacional. 2024. Manual de Contabilidade Aplicada ao Setor Público: 15ª edição. Ministério da Fazenda, Brasília, DF, Brasil.
Brasil. Secretaria do Tesouro Nacional. 2025. Relatório de Projeções Fiscais 2025. Brasília: STN. Disponível em: https://www.tesourotransparente.gov.br/publicacoes/relatorio-de-projecoes-fiscais/2025/20. Acesso em: 21 abril. 2026.
Brooks, C. 2019. Introductory Econometrics for Finance. 4. ed. Cambridge University Press.
Brown, R. L.; Durbin, J.; Evans, J. M. 1975. Techniques for testing the constancy of regression relationships over time. Journal of the Royal Statistical Society: Series B (Methodological), v. 37, n. 2, p. 149-163.
Chow, G. C. 1960. Tests of equality between sets of coefficients in two linear regressions. Econometrica: Journal of the Econometric Society, p. 591-605.
Hyndman, R. J.; Athanasopoulos, G. 2018. Forecasting: principles and practice. 2. ed. Melbourne: OTexts.
Izbicki, R.; Dos Santos, T. M. 2020. Aprendizado de máquina sob uma perspectiva estatística. 1. ed. São Carlos, São Paulo, Brasil. Disponível em: https://rafaelizbicki.com/AME.pdf. Acesso em: 21 abr. 2026.
Lemos, 2023 [Referência completa não encontrada no documento original]
Makridakis, S.; Spiliotis, E.; Assimakopoulos, V. 2018. The M4 Competition: Results, findings, conclusion and way forward. International Journal of Forecasting, v. 34, n. 4, p. 802-808.
Smyl, 2020 [Referência completa não encontrada no documento original]
Tsay, R. S. 2010. Analysis of Financial Time Series. 3. ed. John Wiley & Sons.
Wooldridge, J. M. 2010. Econometric analysis of cross section and panel data. MIT press.
Article originating from the Final Course Project of the Specialization in Data Science and Analytics of the MBA USP/Esalq
To learn more about the course, click here and access the MBX Academy platform