Forecasting Municipal Financial Distress in South Africa: A Machine Learning Approach
Highlights
- Machine learning (ML) using the National Treasury’s 13 financial health indicators forecasts one-year-ahead municipal financial distress.
- Liquidity, solvency, cash coverage, and employment deprivation are identified as key drivers of municipal financial distress.
- ML models can convert the oversight monitoring data into a practical early-warning tool for risk-based municipal oversight.
- The prioritisation of the highest-risk municipalities yields a short, actionable list for targeted support and earlier fiscal recovery action.
Abstract
1. Introduction
- Which indicators contribute most to the models’ predicted distress risk?
- How do penalised logistic regression, random forest, and XGBoost models compare to PR-AUC, recall@K, ROC-AUC, and calibration?
2. Literature Review
2.1. Challenges in Predicting Municipal Financial Distress
2.2. The Application of Machine Learning for the Prediction of Municipal Financial Distress
2.3. Emerging Machine Learning Solutions to the FDP Challenges
2.4. Research Gap and Contribution
3. Materials and Methods
3.1. Overview of the Modelling Pipeline
3.2. Data Sources and Panel Construction
3.3. Outcome Variable: SoLG Financial Distress and NT-13 Reconstruction
3.4. Predictors and Feature Engineering
3.4.1. Indicator Construction
3.4.2. Missing Data and Data Audit
3.4.3. Preprocessing and Feature Engineering
3.5. Train–Validation–Test Split and Time-Aware Cross-Validation
3.6. Prediction Models
3.6.1. Logistic Regression Model
3.6.2. Random Forest Model
3.6.3. Extreme Gradient Boosting
3.6.4. Models Excluded and Rationale
- Support Vector Machines (SVMs). These models yield strong margins but are sensitive to kernel choice and feature scaling, require additional calibration to obtain probabilities, and provide weaker policy legibility relative to logistic regression and tree-based ensembles.
- Artificial Neural Networks (ANNs). These models typically have higher data and tuning demands, yield comparatively opaque explanations, and reduce the ease of audit and communication for oversight bodies.
- Standalone decision trees. Individual trees exhibit high variance and split instability and are retained only as base learners in random forest and XGBoost, where variance is controlled through ensembling.
3.7. Model Classes and Evaluation
3.7.1. Class Imbalance Handling
3.7.2. Evaluation Metrics and Decision Thresholds
3.7.3. Uncertainty Quantification
3.7.4. Model Interpretability
3.8. Data and Code Availability
4. Results
4.1. Descriptive Statistics
4.1.1. Financial Indicators
4.1.2. Socio-Economic and Macro-Economic Context
4.2. Model Performance Results
4.3. Drivers of Financial Distress
4.4. Robustness Checks
4.4.1. Agreement Between Reconstructed NT-13 Labels and Official SoLG Classification
4.4.2. Sensitivity to a Stricter Distress Definition
5. Discussion and Conclusions
5.1. Overview of Main Findings
5.2. Implications for the Kooij Framework and Its Extension
5.3. Policy and Oversight Implications
5.4. Limitations and Directions for Future Research
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
Appendix A. Data and Variable Construction
| Variable Dimension | Variable Label | Indicator | Formula or Construction | Source Dataset |
|---|---|---|---|---|
| Cash solvency | Cash or Cash-Equivalent Position Less Applications | Cash and cash equivalents available for operations after deducting committed applications (unspent conditional grants, statutory commitments) | Cash and cash equivalents—cash-backed committed funds | AFS/NT Local Government Database (mSCOA) |
| Cash Plus Investments | Total immediately available liquid resources (cash plus investments) | Cash and cash equivalents + investments | AFS/NT Local Government Database (mSCOA) | |
| Cash Coverage (Months) | Number of months that available cash can cover operating expenditure | (Cash and cash equivalents + investments − committed funds) ÷ (operating expenditure excluding depreciation and amortisation) ÷ 12 | AFS/NT Local Government Database (mSCOA) | |
| Liquidity Ratio | Short-term liquidity; ability to meet current obligations | Current assets ÷ Current liabilities (as per AFS/NT definition) | AFS/NT Local Government Database (mSCOA) | |
| Current Ratio | Alternative short-term liquidity ratio reported by NT | Current assets ÷ current liabilities (reported as per NT circulars) | AFS/NT Local Government Database (mSCOA) | |
| Debtor Days | Average number of days to collect billed revenue from customers | (Trade and other receivables from exchange transactions ÷ total billed revenue) × 365 | AFS/NT Local Government Database (mSCOA) | |
| Creditor Days | Average number of days taken to pay suppliers and other creditors | (Trade and other payables ÷ total operating expenditure) × 365 | AFS/NT Local Government Database (mSCOA) | |
| Budget solvency | Operating_Surplus_Abs_Audited | Absolute operating surplus or deficit based on audited financial statements | Total operating revenue—total operating expenditure (audited) | AFS/NT Local Government Database (mSCOA) |
| Budget solvency | Operating_Surplus_Pct_Audited | Operating surplus as a percentage of operating revenue | (Operating_Surplus_Abs_Audited ÷ total operating revenue) × 100 | AFS/NT Local Government Database (mSCOA) |
| Budget solvency | Opex_to_Revenue | Operating expenditure as a share of operating revenue (primary source) | Total operating expenditure ÷ total operating revenue (from main NT dataset) | AFS/NT Local Government Database (mSCOA) |
| Service-level solvency | FBS_Water_Coverage | Coverage of free basic water among domestic consumer units | Domestic FBS water consumer units ÷ total domestic water consumer units | NT Local Government Database (mSCOA FBS indicators) |
| FBS_Elec_Coverage | Coverage of free basic electricity among domestic consumer units | Domestic FBS electricity consumer units ÷ total domestic electricity consumer units | NT Local Government Database (mSCOA FBS indicators) | |
| FBS_Sanitation_Coverage | Coverage of free basic sanitation among domestic consumer units | Domestic FBS sanitation consumer units ÷ total domestic sanitation consumer units | NT Local Government Database (mSCOA FBS indicators) | |
| FBS_Refuse_Coverage | Coverage of free basic refuse removal among domestic consumer units | Domestic FBS refuse consumer units ÷ total domestic refuse consumer units | NT Local Government Database (mSCOA FBS indicators) | |
| Pop. Density per km2 | Population density in 2022; a proxy for service demand and settlement patterns | Total population 2022 ÷ land area (km2) | Stats SA Census 2022 and municipal GIS area data | |
| Density_Annual_Growth_2016_2022 | Annualised growth rate of population density between 2016 and 2022 | [(Density_2022 ÷ density_2016)^(1/6) − 1] × 100 | Stats SA Census 2011 and 2022 (derived) | |
| Median_Age_2022 | Median age of the municipal population in 2022 | Median age as reported by Census 2022 (no further transformation) | Stats SA Census 2022 | |
| Avg_HH_Size_2022 | Average household size in 2022 | Total population 2022 ÷ number of households 2022 | Stats SA Census 2022 | |
| Long-term solvency | Repairs and Maintenance Expenditure Level (%) | Repairs and maintenance expenditure as a percentage of asset base | (Repairs and maintenance expenditure ÷ carrying value of property, plant, and equipment) × 100 | AFS/NT Local Government Database (mSCOA) |
| Long-term solvency | Asset Renewal Rehabilitation Expenditure Level (%) | Share of capital expenditure devoted to asset renewal and rehabilitation | (Capital expenditure on renewal/rehabilitation ÷ total capital expenditure) × 100 | AFS/NT Local Government Database (mSCOA) |
| Long-term solvency | Asset Renewal Depreciation Level (%) | Extent to which depreciation is covered by renewal expenditure | Capital expenditure on asset renewal ÷ depreciation × 100 | AFS/NT Local Government Database (mSCOA) |
| Long-term solvency | CAPEX as PCT of Total Expenditure (%) | Capital expenditure as a share of total expenditure | Capital expenditure ÷ (operating expenditure + capital expenditure) × 100 | AFS/NT Local Government Database (mSCOA) |
| Long-term solvency | Solvency Ratio | Overall solvency: ability to cover total liabilities with assets | Total assets ÷ total liabilities | AFS/NT Local Government Database (mSCOA) |
| Long-term solvency | Debt Total Borrowing vs. Total Operating Revenue | Level of interest-bearing borrowing relative to operating revenue | (Total interest-bearing borrowings ÷ total operating revenue) × 100 | AFS/NT Local Government Database (mSCOA) |
| Long-term solvency | GF_Size | Size of general fund/accumulated surplus | Accumulated surplus (general fund) as reported in AFS | AFS/NT Local Government Database (mSCOA) |
| Long-term solvency | GF_to_Revenue | General fund relative to operating revenue | GF_Size ÷ total operating revenue | AFS/NT Local Government Database (mSCOA) |
| Long-term solvency | GF_to_OpEx | General fund relative to operating expenditure | GF_Size ÷ total operating expenditure | AFS/NT Local Government Database (mSCOA) |
| Long-term solvency | NetAssetRatio | Net assets as a share of total assets | Net assets ÷ total assets | AFS/NT Local Government Database (mSCOA) |
| Long-term solvency | Grants_Share | Dependence on operating grants and subsidies | Operating grants and subsidies revenue ÷ total operating revenue | AFS/NT Local Government Database (mSCOA) |
| Long-term solvency | Own_Revenue_Share | Share of operating revenue derived from own sources | Own revenue (rates, service charges, other own income) ÷ total operating revenue | AFS/NT Local Government Database (mSCOA) |
| Long-term solvency | Grants_per_capita | Operating grants and subsidies per capita | Operating grants and subsidies revenue ÷ total population | AFS/NT Local Government Database (mSCOA) and stats SA population |
| Long-term solvency | Own_Revenue_per_capita | Own revenue per capita | Own revenue ÷ total population | AFS/NT Local Government Database (mSCOA) and stats SA population |
| Long-term solvency | Total_OpEx_per_capita | Operating expenditure per capita | Total operating expenditure ÷ total population | AFS/NT Local Government Database (mSCOA) and stats SA population |
| Long-term solvency | BulkPurchases_Pct_OpEx | Bulk purchases and inventory consumed as a share of total operating expenditure | (Bulk purchases + inventory consumed) ÷ total operating expenditure | NT Local Government Database (mSCOA item codes) |
| Long-term solvency | Contracted_Services_Pct_Opex | Contracted services as a share of total operating expenditure | Contracted services ÷ total operating expenditure | NT Local Government Database (mSCOA item codes) |
| Additional governance indicators | Audit Outcome | Audit opinion of the municipality (proxy for financial management quality) | Categorical outcome as per Auditor-General (unqualified, qualified, adverse, disclaimed). Can be recoded as binary flag: 1 = qualified/adverse/disclaimed; 0 = unqualified (with or without findings) | Auditor-General reports/NT Local Government Database |
| Additional governance indicators | Budget_Funding_Position | Whether the municipal budget is funded in terms of MFMA funding compliance | Binary indicator: 1 = funded budget (NT funding criteria met); 0 = unfunded budget | NT budget funding assessments/Local Government Database |
| Additional governance indicators | UIFW_Total | Total unauthorised, irregular, fruitless, and wasteful expenditure incurred | Sum of unauthorised, irregular, fruitless, and wasteful expenditure as disclosed in AFS | AFS/NT Local Government Database (mSCOA) |
| Additional governance indicators | UIFW_to_OpEx | UIFW relative to operating expenditure | UIFW_Total ÷ total operating expenditure | AFS/NT Local Government Database (mSCOA) |
| Additional governance indicators | Unauth_to_OpEx | Unauthorised expenditure relative to operating expenditure | Unauthorised expenditure ÷ total operating expenditure | AFS/NT Local Government Database (mSCOA) |
| Additional governance indicators | Council_Control_Type | Political control configuration of the municipal council (single-party majority, coalition) | Categorical coding based on municipal election results and council composition | IEC election results, COGTA/municipal council records |
| Additional governance indicators | Mayor_Gender | Gender of the mayor (proxy for demographic diversity in political leadership) | Binary indicator: 1 = female mayor; 0 = male mayor | COGTA/municipal websites/council records |
| Additional governance indicators | Voter_Turnout_Pct | Voter turnout at municipal elections (proxy for electoral accountability) | (Valid votes cast ÷ registered voters) × 100, using 2016 and 2021 local election data mapped to financial years | IEC local government election results |
| Additional governance indicators | Water_Service_Provider | Institutional arrangement for water service provision (municipality vs. external provider) | Categorical variable indicating the main water service provider (municipality, water board, other) | COGTA/municipal service delivery arrangements/WSA records |
| Additional governance indicators | Electricity_Service_Provider | Institutional arrangement for electricity distribution | Categorical variable indicating the main electricity distributor (municipality, Eskom) | COGTA/municipal service delivery arrangements/NERSA/Eskom |
| Additional governance indicators | Sanitation_Service_Provider | Institutional arrangement for sanitation services | Categorical variable indicating the main sanitation service provider (municipality vs. external) | COGTA/municipal service delivery arrangements |
| Additional governance indicators | Refuse_Service_Provider | Institutional arrangement for refuse removal services | Categorical variable indicating the main refuse removal service provider | COGTA/municipal service delivery arrangements |
| Additional macro-economic indicators | SAIMD_Employment_Deprivation_2022 | Employment deprivation index as a proxy for labour market-related poverty | SAIMD 2022 employment deprivation score (0–1) at the municipal level; used without transformation | SAIMD 2022 (Stats SA/SAMRC/partner institutions) |
| Additional macro-economic indicators | SAIMD_Education_Deprivation_2022 | Education deprivation index | SAIMD 2022 education deprivation score (0–1) at the municipal level; used without transformation | SAIMD 2022 (Stats SA/SAMRC/partner institutions) |
| Additional macro-economic indicators | SAIMD_LivingEnv_Deprivation_2022 | Living environment deprivation index capturing housing and neighbourhood conditions | SAIMD 2022 living-environment deprivation score (0–1) at the municipal level; used without transformation | SAIMD 2022 (Stats SA/SAMRC/partner institutions) |
| Additional macro-economic indicators | GDP_R_Growth_Pct | Provincial real GDP-R growth rate aligned to the municipal financial year | (Provincial GDP-R_t—provincial GDP-R_{t-1}) ÷ provincial GDP-R_{t-1} × 100, using stats SA GDP-R series and mapping calendar years to financial years | Stats SA GDP-R by province (regional GDP) |
| Additional macro-economic indicators | CPI_Headline_FY_Avg | Average headline CPI inflation over the municipal financial year | Arithmetic mean of monthly headline CPI index values across the municipal financial year (July–June) | Stats SA Consumer Price Index (CPI) |
| Additional macro-economic indicators | Unemp_Prov_FY_Avg | Average provincial unemployment rate over the municipal financial year | Average of quarterly provincial unemployment rates (QLFS) corresponding to the municipal financial year | Stats SA Quarterly Labour Force Survey (QLFS) |
Appendix B. Model Specification Details
| Model | Parameter | Value |
|---|---|---|
| Penalised Logistic Regression (scikit-learn) | standardisation | StandardScaler() |
| penalty | L2 | |
| C (inverse regularisation strength) | 1.0 | |
| solver | liblinear | |
| class_weight | balanced | |
| max_iter | 1000 | |
| Random Forest (scikit-learn) | n_estimators | 1000 |
| max_depth | None | |
| min_samples_split | 2 | |
| min_samples_leaf | 1 | |
| class_weight | balanced_subsample | |
| n_jobs | −1 | |
| random_state | 42 | |
| XGBoost (xgboost. XGBClassifier) | n_estimators | 5000 |
| learning_rate | 0.02 | |
| max_depth | 6 | |
| subsample | 0.8 | |
| colsample_bytree | 0.8 | |
| scale_pos_weight | neg/pos ratio (training set) | |
| eval_metric | logloss | |
| tree_method | hist | |
| n_jobs | −1 | |
| random_state | 42 | |
| early_stopping_rounds | Not used |
| Detail Category | Description |
|---|---|
| Data split and evaluation design | Time-aware split by financial year: model fitting on earlier years, model selection on a held-out validation year, and final evaluation on an out-of-time test year (as implemented in the main notebook) |
| Class imbalance handling | Class weights for logistic regression (class_weight = ‘balanced’) and random forest (class_weight = ‘balanced_subsample’); XGBoost uses ‘scale_pos_weight’ computed from the training sample (negatives/positives) |
| Calibration reporting | Calibration was assessed using the Brier score and reliability (calibration) curves, as reported in the results section |
| Software versions (Google Colab) | Software versions from the executed runtime (Python 3.12.12, scikit-learn 1.6.1, pandas 2.2.2, numpy 2.0.2, xgboost 3.1.2, shap 0.50.0) |
Appendix C. Robustness and Supplementary Results
| Model | PR-AUC (Val) | PR-AUC (Test) | F1 (Val) | F1 (Test) | Recall@30 (Val) | Recall@30 (Test) | ROC-AUC (Test) |
|---|---|---|---|---|---|---|---|
| Penalised logistic regression | 0.849 | 0.856 | 0.177 | 0.671 | 0.234 | 0.256 | 0.850 |
| Random forest | 0.911 | 0.895 | 0.809 | 0.8174 | 0.226 | 0.256 | 0.912 |
| XGBoost | 0.908 | 0.891 | 0.795 | 0.7768 | 0.242 | 0.256 | 0.903 |
| Metric | Random Forest | XGBoost |
|---|---|---|
| Estimate (95% CI) | Estimate (95% CI) | |
| PR-AUC | 0.955 [0.927–0.976] | 0.942 [0.899–0.974] |
| Recall@30 | 0.193 [0.176–0.213] | 0.186 [0.167–0.208] |
| ROC-AUC | 0.923 [0.887–0.955] | 0.915 [0.875–0.950] |



References
- Glasser, M.D.; Wright, J. South African municipalities in financial distress: What can be done? Law Democr. Dev. 2020, 24, 413–441. [Google Scholar] [CrossRef] [Scilit]
- National Treasury. The State of Local Government Finances and Financial Management for the Financial Year Ended as at 30 June 2023; National Treasury: Pretoria, South Africa, 2024.
- Zweni, A.; Koma, S.; Ndevu, Z. Coalition effects on financial and service delivery performance in metropolitan municipalities in Gauteng. J. Local Gov. Res. Innov. 2024, 5, a183. [Google Scholar] [CrossRef] [Scilit]
- Republic of South Africa (RSA). Municipal Finance Management Act, No. 56 of 2003; Government Printer: Pretoria, South Africa, 2003.
- Mbulawa, A. Understanding the impact of financial sustainability on South African municipalities. J. Transdiscipl. Res. South. Afr. 2019, 15, a656. [Google Scholar] [CrossRef] [Scilit]
- Ruplal, K. The Impact of Socioeconomic Factors on Municipal Fiscal Health in South Africa. Doctoral Dissertation, Stellenbosch University, Stellenbosch, South Africa, 2022. [Google Scholar]
- Shozi, S.R. Audit Outcomes and Financial Health of Municipalities in South Africa. Master’s Thesis, University of Cape Town, Cape Town, South Africa, 2023. [Google Scholar]
- Lukáč, J.; Teplická, K.; Čulková, K.; Hrehová, D. Evaluation of the financial performance of the municipalities in Slovakia in the context of multidimensional statistics. J. Risk Financ. Manag. 2021, 14, 570. [Google Scholar] [CrossRef] [Scilit]
- Zhuang, Y.; Wei, H. Early warning model and prevention of regional financial risk integrated into legal system. PLoS ONE 2023, 18, e0286685. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Kang, H.; Chen, G. The Effect of Fiscal Stress Labels on Local Governments’ Financial Management: Evidence from New York State Fiscal Stress Monitoring System. Public Financ. Rev. 2024, 52, 643–678. [Google Scholar] [CrossRef] [Scilit]
- Shiddiqy, R.A.; Prihatiningtias, Y.W. The prediction of financial distress probability in East Java province governments. Int. J. Res. Bus. Soc. Sci. 2022, 11, 152–160. [Google Scholar] [CrossRef] [Scilit]
- Alaminos, D.; Fernández, S.; García, F.; Fernández, M. Data mining for municipal financial distress prediction. In Advances in Data Mining: Applications and Theoretical Aspects; Perner, P., Ed.; Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 2018; Volume 10933, pp. 296–308. [Google Scholar] [CrossRef] [Scilit]
- Antulov-Fantulin, N.; Lagravinese, R.; Resce, G. Predicting bankruptcy of local government: A machine learning approach. J. Econ. Behav. Organ. 2021, 183, 681–699. [Google Scholar] [CrossRef] [Scilit]
- Li, X.; Ge, X.; Chen, C. Several explorations on how to construct an early warning system for local government debt risk in China. PLoS ONE 2022, 17, e0263391. [Google Scholar] [CrossRef] [Scilit]
- Piermarini, D.; Sudoso, A.M.; Piccialli, V. Predicting municipalities in financial distress: A machine learning approach enhanced by domain expertise. arXiv 2023, arXiv:2302.05780. [Google Scholar] [CrossRef] [Scilit]
- Liu, R.P.; Li, H.; Yoon, K.; Vasarhelyi, M.A. Using Machine Learning Algorithms to Improve Fiscal Distress Prediction Models: The Case of U.S. Local Governments. J. Inf. Syst. 2025, 39, 131–155. [Google Scholar] [CrossRef] [Scilit]
- Roberts, D.R.; Bahn, V.; Ciuti, S.; Boyce, M.S.; Elith, J.; Guillera-Arroita, G.; Hauenstein, S.; Lahoz-Monfort, J.J.; Schröder, B.; Thuiller, W.; et al. Cross-validation strategies for data with temporal, spatial, hierarchical, or phylogenetic structure. Ecography 2017, 40, 913–929. [Google Scholar] [CrossRef] [Scilit]
- Hewamalage, H.; Ackermann, K.; Bergmeir, C. Forecast evaluation for data scientists: Common pitfalls and best practices. Data Min. Knowl. Discov. 2022, 37, 788–832. [Google Scholar] [CrossRef] [Scilit]
- Kleinberg, J.; Ludwig, J.; Mullainathan, S.; Obermeyer, Z. Prediction Policy Problems. Am. Econ. Rev. 2015, 105, 491–495. [Google Scholar] [CrossRef] [Scilit]
- Hancock, J.; Khoshgoftaar, T.M.; Johnson, J. Evaluating classifier performance with highly imbalanced Big Data. J. Big Data 2023, 10, 42. [Google Scholar] [CrossRef] [Scilit]
- Lundberg, S.M.; Erion, G.; Chen, H.; DeGrave, A.; Prutkin, J.M.; Nair, B.; Katz, R.; Himmelfarb, J.; Bansal, N.; Lee, S.I. From local explanations to global understanding with explainable AI for trees. Nat. Mach. Intell. 2020, 2, 56–67. [Google Scholar] [CrossRef] [Scilit]
- Kooij, J.; Groot, T. Towards a comprehensive assessment system of local government fiscal health. Maandbl. Voor Account. En Bedrijfsecon. 2021, 95, 233–244. [Google Scholar] [CrossRef] [Scilit]
- Zafra-Gómez, J.L.; López-Hernández, A.M.; Hernández-Bastida, A. Developing a model to measure financial condition in local government: Evaluating service quality and minimising the effects of the socioeconomic environment: An application to Spanish municipalities. Am. Rev. Public Adm. 2009, 39, 425–449. [Google Scholar] [CrossRef] [Scilit]
- Maher, C.S.; Oh, J.W.; Liao, W.J. Assessing fiscal distress in small county governments. J. Public Budg. Account. Financ. Manag. 2020, 32, 691–711. [Google Scholar] [CrossRef] [Scilit]
- Trussel, J.M.; Patrick, P.A. A predictive model of fiscal distress in local governments. J. Public Budg. Account. Financ. Manag. 2009, 21, 578–616. [Google Scholar] [CrossRef] [Scilit]
- Chung, I.H.; Williams, D. Local governments’ responses to the fiscal stress label: The case of New York. Local Gov. Stud. 2020, 47, 808–835. [Google Scholar] [CrossRef] [Scilit]
- Gorina, E.; Maher, C.S.; Joffe, M.D. Local Fiscal Distress: Measurement and Prediction. Public Budg. Financ. 2017, 38, 72–94. [Google Scholar] [CrossRef] [Scilit]
- Trussel, J.M.; Patrick, P.A. Assessing and ranking the financial risk of municipal governments: The case of Pennsyl-vania. J. Appl. Account. Res. 2018, 19, 81–101. [Google Scholar] [CrossRef] [Scilit]
- Cohen, S.; Costanzo, A.; Manes Rossi, F. Auditors and early signals of financial distress in local governments. Manag. Audit. J. 2017, 32, 234–250. [Google Scholar] [CrossRef] [Scilit]
- Lysiak, L.; Kaчyлa, C.B.; Kushnir, A.; Datsenko, V.; Tereshchenko, T. Assessment of Financial Sustainability of Local Budgets in the Budget Management System Using Kohonen Maps. Univers. J. Account. Financ. 2021, 9, 1558–1570. [Google Scholar] [CrossRef] [Scilit]
- Ríos, A.M.; Guillamón, M.D.; Benito, B. The influence of local government transparency on the implementation of the Sustainable Development Goals in municipalities. J. Public Budg. Account. Financ. Manag. 2024, 36, 417–444. [Google Scholar] [CrossRef] [Scilit]
- Chawla, N.V.; Bowyer, K.W.; Hall, L.; Kegelmeyer, W.P. SMOTE: Synthetic Minority Over-sampling Technique. J. Artif. Intell. Res. 2002, 16, 321–357. [Google Scholar] [CrossRef] [Scilit]
- Lundberg, S.; Lee, S. A Unified Approach to Interpreting Model Predictions. arXiv 2017, arXiv:1705.07874. [Google Scholar] [CrossRef] [Scilit]
- Friedman, J.H. Greedy function approximation: A gradient boosting machine. Ann. Stat. 2001, 29, 1189–1232. [Google Scholar] [CrossRef] [Scilit]
- Platt, J.C. Probabilities for SV Machines. In Advances in Large-Margin Classifiers; The MIT Press: Cambridge, MA, USA, 2000; pp. 61–74. [Google Scholar] [CrossRef] [Scilit]
- Brier, G.W. Verification of Forecasts Expressed in Terms of Probability. Mon. Weather Rev. 1950, 78, 1–3. [Google Scholar] [CrossRef] [Scilit]
- Statistics South Africa. Community Survey 2016 [Data Set]. Statistics South Africa, 2016. Available via SuperWEB2 (SuperSTAR) Data Portal. Available online: https://superweb.statssa.gov.za/webapi/jsf/login.xhtml (accessed on 10 February 2026).
- Statistics South Africa. Census 2022 [Data Set]. Statistics South Africa, 2023. Available via SuperWEB2 (SuperSTAR) Data Portal. Available online: https://superweb.statssa.gov.za/webapi/jsf/login.xhtml (accessed on 10 February 2026).
- Alam, A.B.M.M.; Alam, M.; Hoque, A. Spending Pressure, Revenue Capacity and Financial Conditon In Municipal Organizations: An Empirical Study. J. Dev. Areas 2019, 53, 243–256. [Google Scholar] [CrossRef] [Scilit]
- Zamzami, F.; Rakhman, F. Determinants of Local Government Financial Performance in Indonesia. Acad. J. Interdiscip. Stud. 2023, 12, 332. [Google Scholar] [CrossRef] [Scilit]
- Gasior, K.; Jele, J.; Lloyd, C.; Malinga, N.; Noble, M.; Wright, G. Multiple Deprivation in South Africa at Local Municipality Level in 2022 (Report). Council for Scientific and Industrial Research; School of Natural and Built Environment, Queen’s University Belfast; Southern African Social Policy Research Insights. 2024. Available online: https://www.ukesa.info/library/view/multiple-deprivation-in-south-africa (accessed on 10 February 2026).
- Hastie, T.; Tibshirani, R.; Friedman, J. The Elements of Statistical Learning: Data Mining, Inference, and Prediction, 2nd ed.; Springer: Berlin/Heidelberg, Germany, 2009. [Google Scholar]
- Kuhn, M.; Johnson, K. Applied Predictive Modeling; Springer: New York, NY, USA, 2013; Volume 26, p. 13. [Google Scholar]
- Hamdi, M.; Mestiri, S.; Arbi, A. Artificial Intelligence Techniques for Bankruptcy Prediction of Tunisian Companies: An Application of Machine Learning and Deep Learning-Based Models. J. Risk Financ. Manag. 2024, 17, 132. [Google Scholar] [CrossRef] [Scilit]
- Braunsberger, C.; Aschauer, E. Corporate Failure Prediction: A Literature Review of Altman Z-Score and Machine Learning Models Within a Technology Adoption Framework. J. Risk Financ. Manag. 2025, 18, 465. [Google Scholar] [CrossRef] [Scilit]
- Máté, D.; Raza, H.; Ahmad, I. Comparative Analysis of Machine Learning Models for Bankruptcy Prediction in the Context of Pakistani Companies. Risks 2023, 11, 176. [Google Scholar] [CrossRef] [Scilit]
- Kim, H.; Cho, H.; Ryu, D. Corporate Bankruptcy Prediction Using Machine Learning Methodologies with a Focus on Sequential Data. Comput. Econ. 2022, 59, 1231–1249. [Google Scholar] [CrossRef] [Scilit]
- Chen, T.; Guestrin, C. XGBoost: A Scalable Tree Boosting System. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, San Francisco, CA, USA, 13–17 August 2016; pp. 785–794. [Google Scholar] [CrossRef] [Scilit]
- Nguyen, H.; Viviani, J.; Jabeur, S. Bankruptcy prediction using machine learning and Shapley additive explanations. Rev. Quant. Financ. Account. 2023, 65, 107–148. [Google Scholar] [CrossRef] [Scilit]
- Huber, F.; Yushchenko, A.; Stratmann, B.; Steinhage, V. Extreme Gradient Boosting for yield estimation compared with Deep Learning approaches. Comput. Electron. Agric. 2022, 202, 107346. [Google Scholar] [CrossRef] [Scilit]
- Qian, H.; Wang, B.; Yuan, M.; Gao, S.; Song, Y. Financial distress prediction using a corrected feature selection measure and gradient boosted decision tree. Expert Syst. Appl. 2022, 190, 116202. [Google Scholar] [CrossRef] [Scilit]
- Tran, D.; Tham, A.W. Accuracy Comparison Between Feedforward Neural Network, Support Vector Machine and Boosting Ensembles for Financial Risk Evaluation. J. Risk Financ. Manag. 2025, 18, 215. [Google Scholar] [CrossRef] [Scilit]
- Tran, K.; Le, H.; Nguyen, T.; Trung, N. Explainable Machine Learning for Financial Distress Prediction: Evidence from Vietnam. Data 2022, 7, 160. [Google Scholar] [CrossRef] [Scilit]
- Gogas, P.; Papadimitriou, T.; Goumenidis, P.; Kontos, A.; Giannakis, N. Identification of Investment-Ready SMEs: A Machine Learning Framework to Enhance Equity Access and Economic Growth. Forecasting 2025, 7, 51. [Google Scholar] [CrossRef] [Scilit]
- Chowdhury, A.; Kaisar, S.; Naha, R. Bankruptcy prediction for imbalanced dataset using oversampling and ensemble machine learning methods. AIP Conf. Proc. 2023, 2968, 040003. [Google Scholar] [CrossRef] [Scilit]
- Ledger, T.; Rampedi, M. Mind the Gap: Section 139 Interventions in Theory and in Practice; Public Affairs Research Institute (PARI): Johannesburg, South Africa, 2019; Available online: https://pari.org.za/mind-the-gap-section-139-interventions-in-theory-and-practice/ (accessed on 10 February 2026).
- Van Calster, B.; McLernon, D.J.; Van Smeden, M.; Wynants, L.; Steyerberg, E.W. Calibration: The Achilles heel of predictive analytics. BMC Med. 2019, 17, 230. [Google Scholar] [CrossRef] [Scilit]
- Abrahamsen, N.-G.B.; Nylén-Forthun, E.; Møller, M.; de Lange, P.E.; Risstad, M. Financial Distress Prediction in the Nordics: Early Warnings from Machine Learning Models. J. Risk Financ. Manag. 2024, 17, 432. [Google Scholar] [CrossRef] [Scilit]
- Liu, J.; Li, C.; Ouyang, P.; Liu, J.; Wu, C. Interpreting the prediction results of the tree-based gradient boosting models for financial distress prediction with an explainable machine learning approach. J. Forecast. 2022, 42, 1112–1137. [Google Scholar] [CrossRef] [Scilit]







| Study | Metric Used | Imbalance Handling | Validation Design | Interpretability | Contextual Fit |
|---|---|---|---|---|---|
| Alaminos et al. [12] (Spain) | Accuracy only | Not addressed | Random train/test split | Limited (list of significant variables) | Spain, large cities |
| Antulov-Fantulin et al. [13] (Italy) | ROC, PR | Oversampling | Random CV, no blocking | Basic feature importance | Italy, all municipalities |
| Li et al. [14] (China) | Accuracy, general risk classification | Not explicit (risk proxies via CRITIC, MS-AR) | Not explicit | Proxy-level only | Chinese provincial debt risk |
| Piermarini et al. [15] (Italy) | F1, PR curves | Class weights | Five-fold CV, random splits | Expert-driven feature extraction | Italy, aligned with the audit criteria |
| Liu et al. [16] (United States) | F1, accuracy, recall, precision | Undersampling (majority, optimal ratio) | Five-fold CV, random splits | Variable importance only | US, 49 states, LGs |
| Variable | Full Sample | Non-Distressed | Distressed | Diff | p-Value | |||
|---|---|---|---|---|---|---|---|---|
| Mean | Std Dev | Mean | Std Dev | Mean | Std Dev | |||
| Cash Coverage (Months) | 3.687 | 21.949 | 6.796 | 8.739 | 1.971 | 26.41 | −4.824 | *** |
| Debtors Days | −654.012 | 34,311.868 | −2271.676 | 57,529.764 | 238.830 | 845.74 | +2510.505 | |
| Operating Expenditure/Revenue | 1.000 | 6.522 | 0.621 | 10.916 | 1.209 | 0.460 | +0.588 | *** |
| Grant Share of Operating Revenue | 0.478 | 0.271 | 0.530 | 0.302 | 0.449 | 0.249 | −0.080 | *** |
| Employment Deprivation Index | 0.644 | 0.133 | 0.664 | 0.151 | 0.633 | 0.121 | −0.031 | *** |
| Education Deprivation Index | 0.183 | 0.053 | 0.188 | 0.054 | 0.181 | 0.052 | −0.007 | ** |
| Living Environment Deprivation Index | 0.401 | 0.252 | 0.472 | 0.275 | 0.363 | 0.229 | −0.109 | *** |
| Provincial Real GDP-R Growth (%) | 0.494 | 3.555 | 0.632 | 3.595 | 0.418 | 3.532 | −0.214 | ** |
| Provincial Unemployment Rate (%) | 30.707 | 6.596 | 30.299 | 7.362 | 30.933 | 6.125 | +0.633 | ** |
| CPI Inflation (%) | 4.920 | 1.309 | 4.945 | 1.293 | 4.906 | 1.318 | −0.039 | |
| N (Municipality-Years) | 1285 | 457 | 828 | |||||
| Model | PR-AUC (Val) | PR-AUC (Test) | F1 (Val) | F1 (Test) | Recall@30 (Val) | Recall@30 (Test) | ROC-AUC (Test) |
|---|---|---|---|---|---|---|---|
| Penalised Logistic Regression | 0.869 | 0.934 | 0.832 | 0.837 | 0.189 | 0.186 | 0.886 |
| Random Forest | 0.967 | 0.954 | 0.912 | 0.881 | 0.210 | 0.192 | 0.923 |
| XGBoost | 0.959 | 0.941 | 0.877 | 0.886 | 0.210 | 0.186 | 0.915 |
| Model | Set | Brier Score |
|---|---|---|
| Logistic Regression | Validation | 0.143 |
| Logistic Regression | Test | 0.132 |
| Random Forest | Validation | 0.090 |
| Random Forest | Test | 0.108 |
| XGBoost | Validation | 0.113 |
| XGBoost | Test | 0.120 |
| Model | TP | FP | FN | Precision@K | Recall@K | Workload (%) |
|---|---|---|---|---|---|---|
| Penalised Logistic Regression | 29 | 1 | 127 | 0.967 | 0.186 | 12.3 |
| Random Forest | 30 | 0 | 126 | 1.000 | 0.192 | 12.3 |
| XGBoost | 29 | 1 | 127 | 0.967 | 0.186 | 12.3 |
| Naïve (Last Year) | 27 | 3 | 129 | 0.900 | 0.173 | 12.3 |
| Feature | Odds Ratio | 95% CI Lower | 95% CI Upper | p-Value |
|---|---|---|---|---|
| Total_OpEx_per_capita | 307.581 | 17.886 | 5289.378 | <0.001 |
| Own_Revenue_per_capita | 0.013 | 0.001 | 0.129 | <0.001 |
| Creditor days | 9.883 | 1.416 | 69.006 | 0.021 |
| Net asset ratio | 0.155 | 0.035 | 0.692 | 0.015 |
| Cash plus investments | 0.281 | 0.096 | 0.819 | 0.020 |
| Cash or cash equivalent position less applications | 0.301 | 0.038 | 2.376 | 0.255 |
| Pop. density per km2 | 3.113 | 1.009 | 9.602 | 0.048 |
| Unauth_to_OpEx | 2.687 | 1.225 | 5.897 | 0.014 |
| Operating_Surplus_Abs_Audited | 2.419 | 0.696 | 8.411 | 0.165 |
| GF_Size | 0.464 | 0.156 | 1.381 | 0.168 |
| UIFW_Total | 1.992 | 0.552 | 7.195 | 0.293 |
| SAIMD_LivingEnv_Deprivation_2022 | 0.513 | 0.236 | 1.116 | 0.092 |
| Grants_per_capita | 0.522 | 0.265 | 1.030 | 0.061 |
| Median_Age_2022 | 0.573 | 0.319 | 1.028 | 0.062 |
| GF_to_Revenue | 0.593 | 0.045 | 7.828 | 0.691 |
| Current ratio | 0.600 | 0.368 | 0.976 | 0.040 |
| UIFW_to_OpEx | 1.606 | 0.034 | 76.514 | 0.810 |
| Cash coverage (months) | 0.634 | 0.388 | 1.036 | 0.069 |
| GF_to_OpEx | 1.453 | 0.383 | 5.519 | 0.583 |
| Electricity_Service_Provider | 1.449 | 0.854 | 2.459 | 0.169 |
| Official SoLG Flag | Reconstructed Broad NT-13 Label | Reconstructed Strict NT-13 Label | ||||
|---|---|---|---|---|---|---|
| 0 (Non-Distressed) | 1 (Distressed) | Total | 0 (Non-Distressed) | 1 (Distressed) | Total | |
| 0 (non-distressed) | 423 | 34 | 457 | 440 | 17 | 457 |
| 1 (distressed) | 41 | 787 | 828 | 237 | 591 | 828 |
| Total | 464 | 821 | 1285 | 677 | 608 | 1285 |
| Comparison | Accuracy | Precision | Recall | F1-score | Prevalence: SoLG Distressed | Prevalence: Broad Distressed | Prevalence: Strict Distressed |
|---|---|---|---|---|---|---|---|
| SoLG vs. Broad (NT-13) | 0.942 | 0.959 | 0.950 | 0.955 | 0.644 | 0.639 | 0.473 |
| SoLG vs. Strict (NT-13) | 0.802 | 0.972 | 0.714 | 0.823 | 0.644 | 0.639 | 0.473 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Radebe, N.E.; Nomlala, B.C.; Matenda, F.R. Forecasting Municipal Financial Distress in South Africa: A Machine Learning Approach. Forecasting 2026, 8, 18. https://doi.org/10.3390/forecast8010018
Radebe NE, Nomlala BC, Matenda FR. Forecasting Municipal Financial Distress in South Africa: A Machine Learning Approach. Forecasting. 2026; 8(1):18. https://doi.org/10.3390/forecast8010018
Chicago/Turabian StyleRadebe, Nkosinathi Emmanuel, Bomi Cyril Nomlala, and Frank Ranganai Matenda. 2026. "Forecasting Municipal Financial Distress in South Africa: A Machine Learning Approach" Forecasting 8, no. 1: 18. https://doi.org/10.3390/forecast8010018
APA StyleRadebe, N. E., Nomlala, B. C., & Matenda, F. R. (2026). Forecasting Municipal Financial Distress in South Africa: A Machine Learning Approach. Forecasting, 8(1), 18. https://doi.org/10.3390/forecast8010018

