Toolkit for Regression Analysis of Kazakhstan Banking Sector Data

Tool is created for regression, prediction and forecast analysis of macroeconomic and credit data. The package includes functions from existing R packages adapted for banking sector of Kazakhstan. The purpose of the package is to optimize statistical functions for easier interpretation for bank analysts and non-statisticians. The package also provides helper functions for loading an insurance scoring dataset, a past case competition dataset for insurance risk scoring and fair pricing.



output: github_document

AFR

AFR is an R toolkit for regression, prediction and forecast analysis of macroeconomic, credit and financial-sector data. The package includes functions adapted for the banking sector of Kazakhstan and is designed to simplify statistical modelling, diagnostic testing and interpretation of regression results for bank analysts, financial market researchers and non-statisticians.

The package was developed by the Agency of the Republic of Kazakhstan for Regulation and Development of Financial Market (ARDFM).

Installation

You can install the released version of AFR from CRAN:

install.packages("AFR")

Then load the package:

library(AFR)

Main functionality

The package provides tools for:

  • regression model selection;
  • diagnostic testing of regression models;
  • macroeconomic and banking-sector data analysis;
  • forecast and prediction tasks;
  • interpretation of model quality indicators;
  • working with built-in Kazakhstan macroeconomic and financial datasets;
  • loading the OGPO Insurance Scoring Dataset.

Built-in datasets

macroKZ

macroKZ is a built-in quarterly dataset for macroeconomic and financial-sector analysis of Kazakhstan. It includes macroeconomic indicators, exchange rates, interest rates, oil price, real estate indicators, credit portfolio indicators, prudential coefficients, income and expense indicators, provisions and default rate.

The dataset can be loaded as follows:

data(macroKZ)

head(macroKZ)
summary(macroKZ)

Typical use cases include:

  • macroeconomic forecasting;
  • regression analysis with macroeconomic indicators;
  • stress-testing and scenario analysis;
  • assessment of relationships between macroeconomic variables and banking-sector indicators.

finratKZ

finratKZ is a built-in dataset of corporate borrowers. It contains financial ratios and borrower classification indicators used for credit risk analysis and regression modelling.

The dataset can be loaded as follows:

data(finratKZ)

head(finratKZ)
summary(finratKZ)

Typical use cases include:

  • credit risk analysis of corporate borrowers;
  • modelling of borrower default status;
  • regression and classification tasks using financial ratios;
  • exploratory analysis of corporate financial stability and performance.

Regression and diagnostic tools

AFR provides functions for regression analysis, model selection, time-series transformation and model diagnostics.

Examples of available tools include:

  • checkdata() for preliminary data checks;
  • check_betas() for analysing regression coefficients across models;
  • corsel() for multicollinearity analysis;
  • bg() for the Breusch-Godfrey autocorrelation test;
  • bp() for the Breusch-Pagan heteroskedasticity test;
  • gq() for the Goldfeld-Quandt heteroskedasticity test;
  • HP() for the Hodrick-Prescott filter;
  • difflog(), pct1() and pct4() for time-series transformations;
  • reg_test() and regsel_f() for regression testing and model selection.

Example workflow:

library(AFR)

data(macroKZ)

model <- lm(real_gdp ~ imp + exp + poil + eurkzt + tonia_rate, data = macroKZ)

bg(model)
bp(model)
gq(model)

OGPO Insurance Scoring Dataset

AFR also provides helper functions for loading the OGPO Insurance Scoring Dataset. The dataset was prepared for a past case competition focused on insurance risk scoring and fair pricing of compulsory motor third-party liability insurance policies.

The dataset can be used for modelling claim probability, analysing policy-level and driver-level risk factors, validating scoring models and estimating business effects such as loss ratio, premium adjustment and customer retention.

Due to CRAN package size restrictions, the full OGPO datasets are not included directly in the package. They are stored externally as compressed Parquet files in GitHub Releases and are downloaded only when the user explicitly calls the corresponding loading functions. Downloaded files are cached locally and reused in subsequent calls.

ogpo_train <- load_ogpo_train()
ogpo_test_with_target <- load_ogpo_test_with_target()
ogpo_test_final <- load_ogpo_test_final()
data_dictionary <- load_ogpo_data_dictionary()

The files are cached locally in:

"~/.afr/ogpo_insurance_scoring/"

The OGPO dataset has three main parts:

  • load_ogpo_train() loads the training dataset;
  • load_ogpo_test_with_target() loads the test dataset with known target values;
  • load_ogpo_test_final() loads the final scoring dataset;
  • load_ogpo_data_dictionary() loads the data dictionary included in the package.

Notes

The large OGPO datasets are downloaded from GitHub Releases only on explicit user request. They are not downloaded during package installation, package loading, CRAN checks or vignette building.

The built-in datasets macroKZ and finratKZ remain included directly in the package and can be loaded using the standard data() function.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("AFR")

0.3.9 by Sultan Zhaparov, 4 months ago


Browse source code at https://github.com/cran/AFR


Authors: Timur Abilkassymov [aut] , Shyngys Shuneyev [aut] , Alua Makhmetova [aut] , Sultan Zhaparov [aut, cre]


Documentation:   PDF Manual  


GPL-2 license


Imports car, forecast, zoo, olsrr, stats, lmtest, graphics, nlme, ggplot2, tseries, gridExtra, utils, rlang, xts, nortest, goftest, cli, arrow

Suggests knitr, rmarkdown, roxygen2


See at CRAN