# Quantitative Risk Management: Value-at-risk for discrete random variables

Insolvency occurs, when the total value of all assets is smaller than the value of liabilities. And, due to deviations of assets and liabilities from their expected values, any financial institution does face some risk of insolvency. It is the purpose of risk management to correctly estimate this risk, and to adjust the portfolio composition to appropriately match the company’s risk appetite. Here, we will derive the definition of value-at-risk – presumably the most important risk measure at present – and apply it to an exemplary setting with discrete random variables.

## 1 Measuring risk of insolvency

When introducing the definition of value-at-risk, it is helpful to first look at a different but strongly related problem: measuring the risk of insolvency for a newly founded insurance company. Thereby, we assume that the portfolio of the insurance company only consists of insurance policies together with the capital raised by the company owners. Hence, in this setting, insolvency occurs, whenever premium payments and capital are lower than the losses incurred in the insurance business. Defining the end of period wealth ,

with number of loss events , we are interested in the probability

This probability of insolvency (also called probability of default) now shall be determined for a simplified exemplary setup. Thereby, we stipulate the following simplifications:

- fix number of policy holders
- deterministic claim size
- independent loss events
- known loss event probability
- given capital level, zero other assets
- given premium payments

Therefore, we first specify some values for all relevant quantities, in order to fully determine the distribution of the end of period wealth.

############################################## ## visualize VaR for wealth and loss events ## ############################################## ## specify settings nPersons <- 20 claimSize <- 20 p <- 0.6 premiums <- 14 capital <- 20 ## get profit distribution lossEvents <- rev(0:nPersons) profitEvents <- nPersons*premiums - (lossEvents*claimSize) wealthEvents <- profitEvents + capital ## get probabilities eventProbs <- dbinom(lossEvents, size = 20, prob = p) ## get expected wealth expProfit <- sum(profitEvents*eventProbs) ## get wealth distribution wealthDistr <- data.frame(xVals = wealthEvents, pVals = eventProbs) library(ggplot2) ## create profit plot pp1 <- ggplot() + geom_bar(aes(x=xVals, y=pVals), width=5, stat="identity", data=wealthDistr) + xlab("wealth") + ylab("probability")

For the chosen settings, the end of period wealth distribution is visualized in the following plot.

Now, in order to derive the probability of default (PD),

we need to sum up the probabilities of all wealth outcomes with negative value. Decomposed into smaller steps, this amounts to

- identifying all negative outcomes
- extracting the associated probabilities
- summing up the probabilities

```
(pd <- sum(eventProbs[wealthEvents < 0]))
```

For the example, we get a probability of default of

[1] 0.05095195

Let’s now put these results into context. So far, we have been confronted with some given risk setting, as well as with a pre-set level of capital. For this fixed setting, the only thing left for us was measuring the associated risk that we were determined to take. In reality, however, measuring risk is only half the task – what we want instead is adapting our risk, such that it complies with our risk appetite.

In accordance with that, we now extend the setup by allowing adjustments to the level of risk that we take. Hence, we now will allow ourselves to vary the level of capital, in order to set the risk of insolvency according to our own preferences.

## 2 Adjusting risk to our preferences: Value-at-risk

Let’s now assume that our risk appetite is such that we want to limit our risk of insolvency to maximum 2 percent. Hence, the probability of wealth being smaller than zero has to be smaller than 0.02:

Recall that wealth was simply defined as sum of the profits that we make (revenues minus expenditures) and the capital () that we chose to set aside before: . Hence, the distribution of wealth varies with the level of capital, linearly shifting to the right for increasing levels of . Therefore, we first need to relate the problem to a distribution that is fixed and independent of the actual level of . We have three options:

- the distribution of profits
- the distribution of losses
- the distribution of loss events

First, we now plot all three distributions. Thereby, the worst outcomes shall be shown in color, in order to highlight for each distribution the respective region that is relevant for the risk of insolvency. Looking at the smallest five possible outcomes we get the following probabilities and cumulated probabilities:

## display first 5 entries of distribution together with cumulated ## values (tailDistr <- data.frame(lossEvents = lossEvents[1:5], profits = profitEvents[1:5], probs = round(eventProbs, 4)[1:5], cumProbs = round(cumsum(eventProbs), 4)[1:5]))

lossEvents profits probs cumProbs 1 20 -120 0.0000 0.0000 2 19 -100 0.0005 0.0005 3 18 -80 0.0031 0.0036 4 17 -60 0.0123 0.0160 5 16 -40 0.0350 0.0510

As one can see from the tabulated values, the first time that the cumulated probability of the profit distribution exceeds the value of 2 percent is for the fifth smallest outcome. In contrast, this outcome can be found as fifth largest outcome for the other two distributions (loss distribution and the distribution of loss events). Note, however, that the probability of the single worst outcome is too small to be clearly visible in the graphics.

## make up threshold for VaR nTail <- 4 ## create profit distribution with adjustment for colored regions profitDistr <- data.frame(xVals = profitEvents, pVals = eventProbs) profitTail <- profitDistr[1:nTail, ] profitThreshold <- profitDistr[nTail+1, ] ## create loss event distribution with adjustment for colored regions eventDistr <- data.frame(xVals = lossEvents, pVals = eventProbs) eventTail <- eventDistr[1:nTail, ] eventThreshold <- eventDistr[nTail+1, ] source("./rlib/multiplot.R") ## create profit plot pp1 <- ggplot() + geom_bar(aes(x=xVals, y=pVals), width=5, stat="identity", data=profitDistr) + geom_bar(aes(x=xVals, y=pVals), width=5, stat="identity", data=profitTail, fill="red") + geom_bar(aes(x=xVals, y=pVals), width=5, stat="identity", data=profitThreshold, fill="green") + xlab("profit") + ylab("probability") ## create loss plot pp2 <- ggplot() + geom_bar(aes(x=-xVals, y=pVals), width=5, stat="identity", data=profitDistr) + geom_bar(aes(x=-xVals, y=pVals), width=5, stat="identity", data=profitTail, fill="red") + geom_bar(aes(x=-xVals, y=pVals), width=5, stat="identity", data=profitThreshold, fill="green") + xlab("losses") + ylab("probability") ## create loss event plot pp3 <- ggplot() + geom_bar(aes(x=xVals, y=pVals), width=0.3, stat="identity", data=eventDistr) + geom_bar(aes(x=xVals, y=pVals), width=0.3, stat="identity", data=eventTail, fill="red") + geom_bar(aes(x=xVals, y=pVals), width=0.3, stat="identity", data=eventThreshold, fill="green") + xlab("loss events") + ylab("probability") ## combine plots multiplot(pp1, pp2, pp3, cols = 1)

### 2.1 Derivation based on the profit distribution

Let’s first derive the appropriate capital level based on the profit distribution. Therefore, we need to express the default event in terms of the profit distribution. We get:

Based on the profit distribution, we hence need to determine a capital level fulfilling the following constraint:

However, we do not want to chose just any capital level which fulfills the requirements. Otherwise, we simply could choose some completely exaggerated high value. What we want is to find the smallest capital level still fulfilling the constraints, since holding capital reserves is costly. Making as small as possible amounts to making as large as possible. Hence, in the graphics, has to be as far to the right as possible.

Let’s try some values for . As first guess, we chose the value equal to the fourth worst outcome: . Checking the constraint we get:

Hence, a capital level of would be sufficient to diminish the probability of default to the required level. Still, however, we need to check whether it also is the smallest capital level that fulfills the constraint. Therefore, we additionally check a smaller capital level, equal to the outcome of the fifth worst outcome: . Here, we get:

Hence, we found an even better capital level. And this time, any infinitesimal additional reduction of the capital level to , , will lead to a probability of default that exceeds the required safety level:

Hence, the optimal capital level in this case is : it is the smallest amount of capital that is sufficient to restrict the probability of default to the pre-set level of maximum 0.02 percent. Or, considered from a different perspective, it is the optimal capital level in order to guarantee a minimum required survival probability. The capital level obtained this way is generally called value-at-risk, and it plays an important role in the measurement of risk of financial institutions.

The *Value-at-Risk (VaR)* at confidence level associated with a given profit distribution is defined as the smallest value such that is exceeded with probability of maximal . That is,

Equivalently, could also be expressed in terms of the cumulative distribution function of profits. Generally, the cumulative distribution function is defined as:

Hence, expressing the probability of in terms of requires some slight adjustment:

This way, the value-at-risk is defined as:

In our example, this amounts to finding the smallest value of that fulfills

Therefore, we first determine the set of all points fulfilling the constraint:

## get cumulative distribution function of profits profitCdf <- data.frame(xVals = profitDistr$xVals, pVals = cumsum(profitDistr$pVals)) ## plot cdf pp1 <- ggplot() + geom_step(aes(x=xVals, y=pVals), data=profitCdf) ## include line for open interval of admissible points lowerPlotLimit <- (ggplot_build(pp1)$panel$ranges[[1]]$x.range[1]) shiftDown <- -0.0008 interval <- data.frame(xVals=c(lowerPlotLimit, -40), yVals=shiftDown*c(1, 1)) alphaLine <- data.frame(xVals=c(lowerPlotLimit, -40), yVals=c(0.02, 0.02)) openInterval <- data.frame(xVals=-40, yVals=shiftDown) pp2 <- pp1 + geom_line(aes(x=xVals, y=yVals), color="red", data=interval, size=1) + geom_line(aes(x=xVals, y=yVals), color="red", linetype="dashed", size=1, data=alphaLine) + coord_cartesian(xlim = c(lowerPlotLimit, 30), ylim = c( -0.01, 0.4)) + geom_point(aes(x=xVals, y=yVals), shape=79, color="red", data=openInterval, size=5, solid=F) + xlab("profits") + ylab("cumulated probability")

Note that this set is open: due to , the limiting point at the right side is not part of the set itself. This way, any small variation to the left will fulfill the constraint:

Hence, we get .

### 2.2 Derivation based on the loss distribution

As losses are just the negative value of profits, the probability of default can also be expressed in terms of the loss distribution. Replacing with , we get:

Moreover, we can rewrite the constraint for the capital level, such that it is expressed through the cumulative distribution of losses.

Through this, we get some alternative representations of :

Applying this to our example, we first need to determine the cumulative distribution function of losses . Afterwards, we need to find the set of points defined through

## get loss distribution lossDistr <- data.frame(xVals=rev(-profitDistr$xVals), pVals=rev(profitDistr$pVals)) ## get loss distribution cdf lossCdf <- data.frame(xVals=lossDistr$xVals, pVals=cumsum(lossDistr$pVals)) ## get value-at-risk valRisk <- lossCdf$xVals[lossCdf$pVals >= 0.98][1] ## visualize derivation pp1 <- ggplot() + geom_step(aes(x=xVals, y=pVals), data=lossCdf) upperPlotLimit <- (ggplot_build(pp1)$panel$ranges[[1]]$x.range[2]) lowerPlotLimit <- (ggplot_build(pp1)$panel$ranges[[1]]$x.range[1]) shiftDown <- -0.0008 alphaLine <- data.frame(xVals = c(lowerPlotLimit, valRisk), yVals = c(0.98, 0.98)) interval <- data.frame(xVals=c(valRisk, upperPlotLimit), yVals=shiftDown*c(1, 1)) closedInterval <- data.frame(xVals=valRisk, yVals=shiftDown) pp2 <- pp1 + geom_line(aes(xVals, yVals), data=alphaLine, color="red", linetype="dashed", size=1) + geom_line(aes(x=xVals, y=yVals), color="red", size=1, data=interval) + geom_point(aes(x=xVals, y=yVals), shape=16, color="red", data=closedInterval, size=5, solid=F) + xlab("losses") + ylab("cumulated probability")

This time, the set of points fulfilling the constraint is closed to the left, and we can take its left border as value-at-risk.

As a general rule, you can find the value-at-risk through the intersection of the cumulative distribution function and a horizontal line. For the case of the profit distribution, the horizontal line is at height , while it is of height for the loss distribution.

However, there is an exception to this rule whenever the horizontal line intersects the cumulative distribution function exactly in one of the corner points. In this case, the capital level can be further reduced up to the next discrete outcome of profits.

## determine alpha for visualization cornerAlpha <- 0.95 ## set profits cornerProfits <- c(-60, -40, -20, 40, 60) ## set probabilities cornerProbs <- c(0.02, 0.03, 0.55, 0.3, 0.1) ## profit and loss cdf cornerProfitCdf <- data.frame(xVals=c(-80, cornerProfits), yVals=c(0, cumsum(cornerProbs))) cornerLossCdf <- data.frame(xVals=c(-80, rev(-cornerProfits)), yVals=c(0, cumsum(rev(cornerProbs)))) ################################### ## visualize profit distribution ## ################################### pp1 <- ggplot() + geom_step(aes(x=xVals, y=yVals), data=cornerProfitCdf) ## get figure limits lowerPlotLimit <- (ggplot_build(pp1)$panel$ranges[[1]]$x.range[1]) upperPlotLimit <- (ggplot_build(pp1)$panel$ranges[[1]]$x.range[2]) ## get alpha lines for profit distribution alphaLine <- data.frame(xVals = c(lowerPlotLimit, -20), yVals = c(1-cornerAlpha, 1-cornerAlpha)) alphaLine2 <- data.frame(xVals = c(-20, -20), yVals = c(0, 1-cornerAlpha)) pp2 <- pp1 + geom_line(aes(xVals, yVals), data=alphaLine, color="red", linetype="dashed", size=1) + geom_line(aes(xVals, yVals), data=alphaLine, color="red", linetype="dashed", size=1) + geom_line(aes(xVals, yVals), data=alphaLine2, color="red", linetype="dashed", size=1) + xlab("profits") + ylab("cumulated probability") ################################# ## visualize loss distribution ## ################################# pp3 <- ggplot() + geom_step(aes(x=xVals, y=yVals), data=cornerLossCdf) ## get figure limits lowerPlotLimit <- (ggplot_build(pp3)$panel$ranges[[1]]$x.range[1]) upperPlotLimit <- (ggplot_build(pp3)$panel$ranges[[1]]$x.range[2]) ## get alpha lines for loss distribution alphaLine <- data.frame(xVals = c(lowerPlotLimit, 20), yVals = c(cornerAlpha, cornerAlpha)) alphaLine2 <- data.frame(xVals = c(20, 20), yVals = c(0, cornerAlpha)) pp4 <- pp3 + geom_line(aes(xVals, yVals), data=alphaLine, color="red", linetype="dashed", size=1) + geom_line(aes(xVals, yVals), data=alphaLine, color="red", linetype="dashed", size=1) + geom_line(aes(xVals, yVals), data=alphaLine2, color="red", linetype="dashed", size=1) + xlab("losses") + ylab("cumulated probability")

### 2.3 Derivation based on loss event distribution

Losses in turn can easily be related to the underlying loss events of policy holders:

Hence, value-at-risk also can be derived based on the cumulative distribution of loss events . Reformulating the constraint, we get:

Again, we want to find the smallest capital level fulfilling the constraint, in order to not provide any unnecessary capital. Therefore, we simply can render the inequality into an equality, and choose the capital level such that it satisfies:

####################### ## get value-at-risk ## ####################### ## determine confidence level for value-at-risk alpha <- 0.98 ## get number of losses that one needs to be able to withstand numberOfLossesToSecure <- qbinom(p = alpha, size = nPersons, prob = p) ## get value-at-risk (valRisk <- numberOfLossesToSecure * claimSize - nPersons*premiums)

[1] 40

Posted on 2013/11/12, in financial econometrics, R and tagged insurance, value-at-risk. Bookmark the permalink. Leave a comment.

## Leave a comment

## Comments 0