Back to all projects
Statistics

Machine Learning Algorithms for Credit Risk Prediction

Elijah T 0 views 0 downloadsBSc/BA

Notice: This is a sample project for study and reference. Submitting it as your own work violates most universities' academic integrity policies.

Abstract

About This Research Topic

Ask a lender which model best predicts loan default and the honest answer is: it depends on what you are optimising for. This study put seven classification algorithms head-to-head on the same dataset of loan applicants and found that the algorithm with the best overall accuracy was not the one with the best ability to catch actual defaulters, a distinction that matters enormously once a model moves from a spreadsheet into a real lending decision.

This article works through that comparison, testing Logistic Regression, Decision Tree, Random Forest, Gradient Boosting, K-Nearest Neighbours, Naive Bayes, and Support Vector Machine against 1,000 loan applicant records under realistic class-imbalanced conditions. Readers researching related quantitative or financial topics can browse the Business Administration project collection on ScholarNest for comparable studies in finance and risk management.

What follows covers the background to credit risk modelling, the specific problem this study addresses, its objectives, questions, and hypotheses, the key statistical terms used throughout, and closes with frequently asked questions for students and researchers working on credit scoring and classification.

Main Abstract

Credit risk assessment remains a foundational function of financial institutions, directly determining loan approval decisions, pricing, and provisioning for expected credit losses, with the accuracy of default prediction models carrying direct implications for institutional profitability, financial stability, and, at a systemic level, the soundness of the broader financial system. This study statistically examined the determinants of loan default and comparatively evaluated seven machine learning classification algorithms, Logistic Regression, Decision Tree, Random Forest, Gradient Boosting, K-Nearest Neighbours, Naive Bayes, and Support Vector Machine, using a dataset of 1,000 loan applicant records comprising demographic, financial, and credit-history variables.

The study determined the overall default rate and described applicant characteristics, examined bivariate relationships between candidate risk factors and default status, identified statistically significant predictors of default using binary logistic regression, and comparatively evaluated the classification performance of the seven algorithms under class-imbalanced conditions typical of credit risk data. It applied descriptive statistics, Pearson correlation, independent samples t-tests, one-way ANOVA, Chi-square tests, binary logistic regression, and a comprehensive seven-algorithm classifier comparison using accuracy, precision, recall, F1-score, and area under the ROC curve, with class-balanced weighting applied during model training and a stratified 70:30 train-test split used for classifier evaluation.

Results showed an overall default rate of 28.50% (285 of 1,000 applicants). Previous default history (χ2 = 21.16, p < 0.001), collateral provision (χ2 = 4.40, p = 0.036), and employment status (χ2 = 15.25, p < 0.001) were all significantly associated with default. Defaulting applicants had significantly lower mean credit scores (576.36) than non-defaulting applicants (640.15; t = -12.03, p < 0.001) and significantly higher debt-to-income ratios (0.349 versus 0.217; t = 12.92, p < 0.001). Binary logistic regression identified credit score (OR = 0.304 per standard deviation, p < 0.001), debt-to-income ratio (OR = 3.601 per standard deviation, p < 0.001), employment years (OR = 0.614, p < 0.001), previous default history (OR = 2.887, p < 0.001), absence of collateral (OR = 1.859, p = 0.001), unemployment status (OR = 3.416, p < 0.001), and loan amount (OR = 1.397, p < 0.001) as statistically significant predictors of default, with the overall model explaining a substantial proportion of variance (McFadden pseudo R² = 0.342).

In the seven-algorithm comparative classification exercise, Random Forest achieved the highest overall accuracy (81.67%) and precision (69.14%), while Logistic Regression achieved the highest area under the ROC curve (87.63%) and tied for the highest recall (79.07%) alongside Support Vector Machine, with Gradient Boosting, Naive Bayes, Decision Tree, and K-Nearest Neighbours trailing across most metrics. Random Forest and Gradient Boosting feature importance rankings both converged on debt-to-income ratio and credit score as the two dominant predictors, corroborating the logistic regression findings. The study concludes that debt-to-income ratio, credit score, prior default history, and employment stability are the dominant statistical determinants of credit default risk, and that the choice between Logistic Regression and Random Forest as a deployed credit-scoring model should be guided by an institution's relative prioritisation of overall classification accuracy, favouring Random Forest, against default-detection sensitivity and regulatory interpretability, favouring Logistic Regression, rather than by accuracy alone. It recommends that financial institutions incorporate debt-to-income ratio and credit score as primary automated screening criteria, apply class-rebalancing techniques when training credit-scoring models, and maintain logistic regression-based scorecards alongside ensemble methods to satisfy both predictive performance and regulatory interpretability requirements.

Chapter One Preview

Background to the Study

Credit risk, the risk of financial loss arising from a borrower's failure to meet contractual debt obligations, is one of the most consequential risk categories faced by banks, microfinance institutions, and other lenders. Accurate assessment of credit risk at the point of loan origination directly shapes an institution's approval decisions, interest rate pricing, required loan-loss provisioning, and, in aggregate across a loan portfolio, its overall capital adequacy and financial stability. Historically, credit risk assessment relied heavily on judgmental, officer-based evaluation, an approach increasingly recognised as inconsistent across evaluators and poorly suited to the loan application volumes typical of modern retail and digital lending.

The latter half of the twentieth century saw the progressive formalisation of credit risk assessment through statistical credit scoring models, most notably binary logistic regression, which gave lenders a standardised, statistically validated, and directly interpretable way to estimate a loan applicant's probability of default based on observable financial and demographic characteristics. In the past two decades, this statistical credit scoring tradition has been substantially extended through machine learning classification algorithms, including decision trees, random forests, gradient boosting methods, and support vector machines, approaches capable of capturing complex, non-linear relationships among risk factors that classical logistic regression's linear specification may not fully accommodate. Regulators such as the Basel Committee on Banking Supervision have continued to update their principles for credit risk management as these modelling approaches have matured.

This proliferation of available modelling approaches raises a practically consequential question: among the diverse array of classification algorithms, which offers the most statistically defensible and practically deployable predictive performance for a given credit risk dataset, and how should that determination account for the multiple, sometimes competing performance dimensions, overall accuracy, default-detection sensitivity, regulatory interpretability, relevant to real-world credit risk management? This question is complicated further by a defining statistical characteristic of credit risk data: significant class imbalance, since most loan applicants in most lending portfolios do not, in fact, default, a pattern this study's own 28.5% default rate, while elevated relative to some conventional retail lending contexts, still reflects, requiring careful methodological attention to class-imbalance-aware model training and multi-metric evaluation throughout.

Nigerian and broader African financial institutions, operating within credit markets marked by comparatively limited historical credit bureau data coverage, a substantial informal and self-employed borrower segment, and rapidly expanding digital and microfinance lending channels, face particularly acute practical stakes in this credit risk modelling question. The Central Bank of Nigeria's Credit Risk Management System was established precisely to address the paucity of consolidated credit information that had historically made consistent risk classification difficult across Nigerian lenders. The capacity to statistically identify, with confidence, the specific financial and demographic factors most strongly associated with default risk, and to select a classification methodology matched to an institution's specific risk-management priorities and interpretability requirements, represents a genuinely high-value application of applied statistics and machine learning to a pressing institutional and macro-financial stability challenge.

This study undertakes a comprehensive statistical and machine learning investigation of loan default risk, applying binary logistic regression as both a classical inferential tool and a baseline classification algorithm, and comparatively evaluating it against six additional machine learning classifiers, Decision Tree, Random Forest, Gradient Boosting, K-Nearest Neighbours, Naive Bayes, and Support Vector Machine, using a comprehensive, multi-metric evaluation protocol under realistic class-imbalanced conditions. By triangulating findings across formal bivariate hypothesis testing, inferential logistic regression, a seven-algorithm machine learning comparison, and tree-based feature importance measures, the study is positioned to distinguish genuinely robust, cross-methodologically consistent determinants of default risk from findings that might otherwise be artefacts of a single modelling choice, a safeguard that matters given the direct financial consequences attached to credit-scoring model deployment decisions in practice.

Statement of the Problem

Despite the wide and growing availability of machine learning classification tools, many Nigerian and emerging-market financial institutions, particularly smaller microfinance institutions and digital lenders, continue to rely on a single credit-scoring methodology, most commonly either a simple, non-statistically-validated judgmental scorecard or a single logistic regression model, without systematically and rigorously comparing its performance against a comprehensive range of alternative machine learning approaches on their own institutional data. This creates a risk that institutions either forgo meaningful predictive accuracy improvements available through more sophisticated ensemble methods, or adopt complex machine learning models without first establishing, through rigorous comparison, that the added complexity yields a genuine and interpretable predictive advantage appropriate to their specific regulatory and risk-management context.

A considerable portion of existing comparative credit risk machine learning literature also evaluates classifiers using overall accuracy as the primary or sole performance metric, despite the well-established statistical principle that accuracy is a particularly misleading metric under the class-imbalanced conditions characteristic of credit risk data, where a naive classifier predicting every applicant as a non-defaulter can achieve deceptively high accuracy while failing to identify the substantial majority of genuine default risk, a failure mode of direct and severe financial consequence to a lending institution. There is also comparatively limited Nigerian undergraduate statistics research that applies formal class-imbalance-aware model training, such as class-weighting, alongside a comprehensive, multi-metric evaluation protocol spanning as many as seven distinct classification algorithms within a single, methodologically coherent research framework.

It is against this backdrop that this study statistically investigates the determinants of loan default risk and comparatively evaluates, under a comprehensive multi-metric and class-imbalance-aware evaluation protocol, seven distinct machine learning classification algorithms, providing an empirically grounded, statistically rigorous basis for credit-scoring model selection appropriate to differing institutional risk-management priorities.

Aim and Objectives of the Study

The aim of this study is to statistically analyse the determinants of loan default risk and comparatively evaluate the performance of seven machine learning classification algorithms for credit risk prediction. The specific objectives are to:

1. Determine the overall default rate and describe the financial and demographic characteristics of the loan applicant sample.

2. Examine the bivariate association between selected categorical risk factors (previous default history, collateral provision, employment status) and default status.

3. Compare mean credit score and debt-to-income ratio between defaulting and non-defaulting applicants.

4. Identify the statistically significant independent predictors of default using binary logistic regression.

5. Comparatively evaluate the classification performance of Logistic Regression, Decision Tree, Random Forest, Gradient Boosting, K-Nearest Neighbours, Naive Bayes, and Support Vector Machine using accuracy, precision, recall, F1-score, and AUC under class-imbalance-aware training conditions.

6. Rank the relative importance of predictor variables using Random Forest and Gradient Boosting feature importance measures.

Research Questions

1. What is the overall default rate among loan applicants, and what are their key financial and demographic characteristics?

2. Is there a statistically significant association between previous default history, collateral provision, employment status, and default?

3. Do credit score and debt-to-income ratio differ significantly between defaulting and non-defaulting applicants?

4. Which financial and demographic factors are statistically significant independent predictors of default?

5. Which of the seven classification algorithms evaluated achieves the best overall predictive performance for default classification under class-imbalanced conditions?

6. Which predictor variables contribute most to default classification according to feature importance measures?

Significance of the Study

This study is significant to financial institutions, banks, and microfinance lenders seeking an empirically grounded, statistically validated basis for selecting and deploying credit-scoring models appropriate to their specific risk-management priorities, whether prioritising overall classification accuracy, default-detection sensitivity, or regulatory interpretability. For credit risk officers and regulators, the quantified odds ratios and comparative classifier performance results offer direct, statistically interpretable input for both individual lending decisions and portfolio-level risk-management policy.

For statisticians and machine learning researchers, the study contributes a methodologically rigorous, seven-algorithm comparative evaluation conducted under realistic class-imbalanced conditions with a comprehensive multi-metric protocol, directly addressing a practically important and frequently under-examined dimension of comparative credit risk machine learning research. Readers exploring related quantitative methods may also find the Statistics project collection and the Accounting project collection useful complementary resources.

Academically, the study serves as a comprehensive reference for students undertaking financial statistics, credit risk analytics, or comparative machine learning research, demonstrating a complete analytical workflow from descriptive statistics through advanced multi-algorithm model comparison under realistic, class-imbalanced conditions.

Scope of the Study

This study is restricted to the statistical analysis of a structured, cross-sectional dataset of 1,000 loan applicant records comprising demographic (age), financial (monthly income, loan amount, loan term, employment years), credit-history (credit score, debt-to-income ratio, number of previous loans, previous default history), and contextual (collateral provision, loan purpose, employment status, marital status) variables. The analysis covers descriptive statistics, Pearson correlation, independent samples t-tests, one-way ANOVA, Chi-square tests, binary logistic regression, and a seven-algorithm machine learning classifier comparison, Logistic Regression, Decision Tree, Random Forest, Gradient Boosting, K-Nearest Neighbours, Naive Bayes, and Support Vector Machine, evaluated via a stratified 70:30 train-test split with class-balanced weighting.

The study does not extend to macroeconomic stress-testing, portfolio-level credit risk aggregation such as Value-at-Risk or Expected Shortfall estimation, loss-given-default or exposure-at-default modelling, or deep learning-based approaches, all of which are recommended as areas for further research.

Operational Definition of Terms

Default: A binary outcome, coded 1 if a loan applicant failed to meet their contractual repayment obligations, and 0, non-default, otherwise.

Debt-to-Income (DTI) Ratio: The proportion of an applicant's monthly income committed to existing debt repayment obligations, expressed as a decimal between 0 and 1.

Credit Score: A numerical summary measure, on a 300 to 850 scale in this study, of an applicant's creditworthiness, derived from their credit history and repayment behaviour.

Probability of Default (PD): The estimated likelihood, typically expressed as a probability between 0 and 1, that a borrower will default on their debt obligation within a specified time horizon.

Class Imbalance: A condition in classification data where one outcome class, here, default, occurs less frequently than the other, complicating standard model training and evaluation procedures.

Area Under the ROC Curve (AUC): A performance metric summarising a binary classification model's ability to discriminate between defaulting and non-defaulting applicants across all possible classification thresholds.

Conclusion

There is no single best algorithm for credit risk prediction, only the best algorithm for a given institution's priorities. Random Forest edged out the field on overall accuracy, but Logistic Regression caught more actual defaulters and remains far easier to justify to a regulator. For most lenders, that argues for running both: a transparent, interpretable scorecard for compliance and explanation, and an ensemble model as a secondary check where raw predictive power matters most. Students and researchers exploring related financial or statistical questions can find further reference material in the ScholarNest project research library, including comparable studies across business administration, accounting, and statistics.

Frequently Asked Questions

Which algorithm predicted loan default most accurately in this study?

Random Forest achieved the highest overall accuracy (81.67%) and precision (69.14%), while Logistic Regression achieved the highest AUC (87.63%) and tied for the highest recall alongside Support Vector Machine.

What are the strongest predictors of loan default?

Debt-to-income ratio and credit score were the two dominant predictors, confirmed consistently across logistic regression, Random Forest feature importance, and Gradient Boosting feature importance.

Why does accuracy alone give a misleading picture of credit risk models?

Credit risk data is class-imbalanced, since most applicants do not default, so a naive model predicting no defaults at all can score high on accuracy while missing most of the real default risk, which is why this study also evaluated precision, recall, F1-score, and AUC.

What is class imbalance and how was it handled in this study?

Class imbalance occurs when one outcome, here default, is less common than the other. This study applied class-balanced weighting during model training and used a stratified 70:30 train-test split for evaluation.

Should banks use Random Forest or Logistic Regression for credit scoring?

The choice depends on institutional priorities: Random Forest offers higher overall accuracy, while Logistic Regression offers stronger default-detection sensitivity and the interpretability regulators typically expect from deployed scorecards.

What was the overall default rate in the dataset?

The dataset recorded an overall default rate of 28.50%, or 285 of 1,000 loan applicants.

Which factors were statistically significant predictors of default?

Credit score, debt-to-income ratio, employment years, previous default history, absence of collateral, unemployment status, and loan amount were all statistically significant predictors in the logistic regression model.

What recommendations does the study make for lenders?

It recommends incorporating debt-to-income ratio and credit score as primary automated screening criteria, applying class-rebalancing techniques during model training, and maintaining logistic regression-based scorecards alongside ensemble methods.

Is the dataset used in this study from a real financial institution?

The dataset is a structured, simulated dataset built to reflect realistic relationships and effect sizes documented in prior credit risk literature, so figures should be read as illustrative of methodology rather than institution-specific findings.

Where can I find more research like this?

Related studies in finance, risk analytics, and applied statistics are available in the Business Administration, Accounting, and Statistics sections of the ScholarNest project research library.

Purchase to unlock the full material.