R

Parallel Programming in R: Easy As 1, 2, 3,...

Interpretative languages can be slow to perform certain routines that would otherwise be quick in compiled languages. While speed is often not the reason one uses an interpretative language such as R, reducing computational time can be easy with the use of parallel programming. Non-parallel loops, whose iterations are independent of each other, can be substituted for parallel loops with…

Non-Linearity and the RWA Formula

Some of you might find this interesting. Often a lot of emphasis is placed on the quantification of , , and under the AIRB approach at banks (recall). Sometimes it is easy to lose sight of what is actually driving , and hence, the amount of capital institutions must hold in reserve. Some banks adopt this AIRB framework in the…

AIRB Risk-Weighted Assets

When banks adopt the Advanced Internal Ratings-Based approach to calculate risk-weighted assets, they must adhere to the specific guidelines and formulas governing the approach. Banks are allowed to quantify the parameters (e.g. PD, LGD, EAD) used in the Basel capital formula, but cannot deviate from the analytic formula used to determine RWA. RWA is merely the unexpected loss, less the…

Information Value in R

In a recent post, we discussed Weights of Evidence and how they are used to calculate the Information Value. Below is one way of computing this value in R. Specifically, the function requires the user to specify the "good" response column, the "bad" response column, the subgroup (or bin) column, and of course the import dataset. To treatment indeterminate WoE…

Generalized Additive Models

Recall the form of a generalized linear model: where predictors/variables have been selected to describe the phenomenon of the link function . Here we assume that the response variable is explained by a linear combination of independent variables. However, there is no theoretical justification why the dependent variable should have a linear relationship with the independent variables  .  This oversimplification may cause…

Weights of Evidence and the Information Value

In order to determine which variables demonstrate a high level of predictive power, we calculate the binned Weights of Evidence (WoE) and the associate Information Value (IV). Generally speaking, the IV provides a measure of how well an explanatory variable  is able to distinguish between binary responses (e.g. "good" versus "bad") in some target variable. The idea is if a variable  has…

VARs in R: VAR, TVAR, and RVAR

Risk measures come in many varieties. Some are mean-based, some are median-based. Some are coherent, some are not. However, most risk measures of interest satisfy law-invariance, translation invariance, positive homogeneity, and monotonicity. Three examples of such are Value-at-Risk (VAR), Tail Value-at-Risk (TVAR) (or Expected Shortfall), and Restricted Value-at-Risk (RVAR). VAR is defined as It represents the maximum value a distribution  can attain within confidence level .…

Herfindahl–Hirschman Index

The Herfindahl–Hirschman Index is a measure of the size of subgroups in relation to its containing group. It is often used in econometrics to measure the market share of companies (subgroup) in relation to an industry (group). For simplicity, it can be interpreted as a measure of competition or concentration. The measure itself is quite simple , given by the expression:…

Batch Importing and Data Aggregation

I was recently sent a program that was well over 20,000 lines of code long. If you work in the software industry or regularly code in a legacy language, you might consider this normal. (And if so, you might refer to 20,000 lines of code as 20 KLOCs.) However, the program was coded in a fairly compact language (R) and the program itself implemented a…

Population Stability Index

One way to measure 'shifts' in the proportion of observations within subgroups is by the Population Stability Index (PSI). When a sample population is classified into various subgroups, one might want to establish whether those subgroups are stable with respect to a base population. The PSI is quantified by the formula: where and refer to the proportion of observations belonging to the subgroup…