I am not a fan of articles where the authors use widgets and other unrelatable examples to illustrate complex concepts. Here I will illustrate the use of copulas in finance using the example of risk aggregation to drive through the points. First, though, it is important to briefly explain the risk aggregation problem. There are plenty of texts available on the internet which go in great detail about the inner workings of copulas. My goal is to help the reader develop an intuitive understanding of how copulas are used in finance.

**1. The Risk Aggregation Problem**

A bank typically computes economic capital for its various risk categories (credit risk, interest rate risk, operational risk, trading risk, etc…). The economic capital for these disparate risk categories is frequently calculated at a granular level. Of course, the more granular the risk measurements the harder it is to get a clear picture of the top-of-the-house risk. This is where it gets complicated. A simple sum of the risks would not take into account the diversification benefits (as it would ignore the correct dependency structure).

If we wanted to perform a simple arithmetic sum of the standalone economic capital measures across the disparate risks and arrive at the correct bank capital (that which takes into account diversification), we would have to make some very strong and unrealistic distributional assumptions. Basically, all of the standalone economic capital measures need have: 1) perfect dependency, and 2) identical marginal and joint distributions. Since defending these assumptions would be an unenviable task, we, therefore, need a method that will allow us to 1) determine the appropriate dependencies between risk categories, 2) determine the marginal distributions separate from the joint distributions and 3) combine the standalone risk measures into a single composite measure of risk for the Bank.

Alternatively, banks have employed the Variance-Covariance approach based on Markowitz’s (1959) mean-variance analysis, described in various texts. Embrechts (2015) provides a thorough discussion of the potential problems with the use of the Markowitz approach in modeling dependencies for risk calculations. In summary, the Variance-Covariance approach to risk aggregation would only be feasible in cases where all individual risks are normally distributed. The major drawbacks of the approach may not even be on its reliance on the normality of the distributions but more generally on the assumption of distributional equality between the individual risk category returns and the joint portfolio return. If this equality does not hold, the Variance-Covariance approach will result in a biased estimate for the total Bank economic capital.

In this article, I will illustrate the use of copulas for modeling dependence in risk calculations. Recall, one of the major drawbacks of the Variance-Covariance method is the rigid assumption of distributional equality. A benefit of copulas for portfolio modeling is their flexibility in distributional assumptions. The copula model imposes no restrictions on the marginal distributions of the individual risk categories by decoupling those distributions from the dependency structure between categories. Certain copula structures also allow for heavy tails in the dependency structure of the different risk categories, which is critical for the accuracy of economic capital calculations designed to capture extreme risks.

The rest of this article is structured as such: Section 2 will present the building blocks of the copulas which are correlations and dependence. Then in Section 3, I will define copulas, and distinguish between Gaussian and Student-t copulas. Section 4, walks the reader through generating correlated random sample using a copula with both a Gaussian and Student-t copula with Beta and Generalized Extreme Value marginals. Finally, in section 5, I will illustrate how to aggregate the risk measure (such as value-at-risk (VAR) or expected shortfall (ES) ) of two portfolios by using a Gaussian and Student-t copula with Student-t and Gamma marginals, in R, without using any of the available copula packages. I always find being able to implement complex concepts helps to better understand them.

**2. Correlations & Dependence**

Events are considered dependent if the occurrence of one event affects the occurrence of the other. On the other hand, events are considered independent if the occurrence of one event does not affect the probability of a subsequent event. The 2007-2008 Financial Crisis taught us that even risks that were previously thought of as being independent can exhibit a large degree of co-movement, especially during times of stress.

Although the term ‘correlation’ is not a uniquely defined term, correlations are often narrowly defined and typically referred to as a measure of linear dependency (i.e. Pearson correlation). Pearson correlation though is essentially a measure of the central tendency, involving first and second moments. The pitfalls of using linear correlation coefficient as a dependence measure in finance have long been documented. General dependency, on the other hand, has a broader meaning and involves ANY type of relationship which may exist between random variables (e.g., relationships can be linear or nonlinear). In finance, the term correlation broadly refers to the co-movement of asset values, which have been known to be nonlinear.

**2.1 Linear Correlation –Pearson Correlation**

Linear correlation (Pearson Correlation) is the most common measure for expressing dependency. It is a covariance-based linear measure and describes how often a change in one variable will cause a change in the same direction for the other variable.

Two reasons for the popularity of linear correlations might be that it is relatively easy to calculate and intuitively easier to understand than other dependence measures. In certain instances, it may be appropriate, but in many cases, it underestimates the “true” co-movement of variables and leads to incorrect risk measures.

**2.2 Rank Correlation –Spearman rho and Kendall’s Tau**

Rank correlations are measures of concordance for random vectors. They assess how well a monotonic function can describe the relationship between two variables without making any assumptions about the underlying distributions of these variables. In particular, they measure the extent to which, as one variable increases, the other variable tends to increase, without requiring that increase to be represented by a linear relationship. To calculate the rank correlation scalar value, we only need to know the size of the data sets and the ordering of the sample for each variable, not the actual values themselves. Therefore, unlike linear correlation, the rank correlation value does not depend on the marginal distributions of the variables.

Rank correlations also suffer from some of the same weakness in assessing the dependencies as the Pearson correlation, in particular, zero correlations derived from the rank correlation does not necessarily mean independence.

**2.3 Why Rank Correlations work best with Copulas**

To build a copula, we need to assess the degree of association in some way. Unlike linear correlation coefficients, rank correlation is preserved when nonlinear monotonic transformations are applied to random variables. For this reason, it is more appropriate to use rank correlations to calibrate copulas, where each random variable has a uniform transformation of its underlying distribution on the unit interval [0,1]. An important note is that copulas themselves are invariant under strictly increasing transformation.

**2.4 Tail dependence**

Tail dependency is the probability of an extreme event given that other correlated variables experience an extreme event; for example, the probability that a bank suffers an extreme loss in its loan portfolio given that there has already been an extreme loss event in the loan portfolio.

The correlation measures described above (linear and rank correlations) fail to capture tail dependence and as such, they can understate the probability of extreme events that lead to large losses. The tail dependence coefficient is capable of quantifying extreme simultaneous events. Similar to linear correlation measure (Pearson Correlation) and rank correlation measures (Kendal’s tau and Spearman’s rho), tail dependence is a scalar measure of dependence.

Correlation coefficients are controlled by small movements around the mean and therefore fail to describe the dependence between extreme events. Tail dependence measures the propensity of joint events to concentrate in the tail of the distribution, leading to the probability that severe losses are more likely to happen together. With respect to credit risk, tail dependence is defined as the probability that a borrower exceeds a default threshold value, given that another borrower exceeds a threshold value, and the default thresholds are defined far out in the tail of its distribution. Intuitively, it is easy to see that tail dependence becomes more of a problem during economic downturns. To this end, tail dependence can be thought of as a measure of systemic risk.

Embrechts et al provide simple closed-form formulas to calculate the tail dependence coefficient for the Gaussian and Student-t-Copulas. These will not be further discussed here.

**3. Copulas (A little bit of theory and math)**

A copula is a stochastic concept of dependency. The copula function is the “bridge” that connects marginal distributions to a joint distribution.

As illustrated below, copula theory states that for a given joint distribution function, having marginal distributions, there will always be a unique copula function that joins these marginals to their joint distribution as:

where:

is the joint distribution function.

contains separately the marginal distribution characteristics in the joint distribution function F.

is the copula and thus contains the dependency structure.

If we define for as the uniform marginals then the copula is defined by inverting the equation above such that:

A copula function can take on many forms, with the Normal and Student-t copula being the most common.

**3.1 Gaussian Copula**

The Gaussian or normal copula structure is one of the most basic and commonly used copula structures due to its well-understood parameter space and ease of implementation. One of the primary drawbacks of the Gaussian copula, similar to the Gaussian distribution, is its lack of tail weight or ability to capture extreme values. The Gaussian copula structure takes the form:

where

- is a dx1 vector.
- are uniform marginals
- is the joint standard normal cumulative distribution function
- is the inverse of the normal cumulative distribution function
- is the dependence matrix

The Gaussian copula is completely determined by the correlation matrix R. To generate random variables from Gaussian copula, it is enough to **simulate** a vector from the standard multivariate normal distribution with correlation matrix R and then to transform this vector through a univariate cumulative distributions function so that you obtain a vector from the chosen copula.

- Find the Cholesky decomposition of the correlation matrix , such that .
- Simulate independent standard normal random numbers from .
- Set .
- Set for .
- The resulting vector is .

The vector is a random variate from the n-dimensional Gaussian copula.

**3.2 Student-t Copula**

The Student-t or t copula and its variations and estimation procedures are discussed in depth in Demarta and McNeil (2004). The t copula, unlike the Gaussian copula, allows for heavier distribution tails, to account for extreme values. The amount of tail dependence of the copula is dictated by its degrees of freedom parameter. The smaller the degrees of freedom parameter of the distribution the heavier the tail weight, and the higher the likelihood assigned to extreme events. Conversely the larger the degrees of freedom the smaller the tail weight, with the t copula converging to the zero tail weight Gaussian copula as the degrees of freedom approach infinity. The t copula structure indexed by t, with dependency matrix and degrees of freedom parameter, takes the form

- is a dx1 vector
- is the degrees of freedom
- are uniform marginals
- is the joint t cumulative distribution function
- is the inverse of the t cumulative distribution function
- is the dependency matrix

The Student-t copula is defined by two parameters: the correlation matrix R and the number of degrees of freedom, ν. To **simulate** random variates from the Student-t copula with the correlation matrix R and ν degrees of freedom, we can use the following algorithm:

- Find the Cholesky decomposition of the correlation matrix , such that .
- Simulate independent standard normal random numbers from .
- Simulate a random number from independent of .
- Set .
- Set .
- Set for where denotes the univariate Student-t distribution function with degrees of freedom.
- The resulting vector is .

The vector is a random variate from the n-dimensional t copula .

### 4. For the mathematically challenged

. . . the steps outlined in section 3.1 and 3.2, boil down to what we present in code along with graphical outputs.

**4.1. Simulation of Gaussian Copula (w/ Correlation = 0.5) random numbers.**

- Generate samples from a correlated multivariate normal and create a scatterplot of the two variables (x[,1] and x[,2]).

library(ggplot2)

library(MASS)

library(actuar)

library(evd)

Sigma = matrix(c(1,.5,.5,1),2,2)

x = data.frame(mvrnorm(n = 5000, rep(0, 2), Sigma))

p = ggplot(x, aes(x[,1],x[,2])) + geom_point() + theme_classic()

ggExtra::ggMarginal(p, type = "histogram")

2. The variables are transformed to a uniform scale (unit square). Any distribution can be transformed into a uniform distribution via its CDF.

x_cdf <- cbind(pnorm(x[,1]),pnorm(x[,2]))

z1 <- x_cdf[,1]

z2 <- x_cdf[,2]

p <- ggplot(x, aes(z1,z2)) + geom_point(colour = "darkblue") + theme_classic()

ggExtra::ggMarginal(p, type = "histogram")

3. Transform the marginals back to the desired scales of the data to generate the simulated dependent Generalized Extreme Value and Beta values.

**4.2 Simulation of Student-t Copula (w/ Correlation = 0.5, df = 5) random numbers**

1. Generate samples from a correlated multivariate t distribution and generate a scatterplot of the two variables (x[,1] and x[,2]).

2. The variables are transformed to a uniform scale (unit square). Any distribution can be transformed into a uniform distribution via its CDF.

3. Transform the marginals back to the desired scales of the data to generate the simulated dependent Generalized Extreme Value and Beta values.

Now we know how to simulate dependent random variates by (1) generating random variables from the distribution specified by the copula along with the dependence structure we want, (2) transform these random variates to a unit scale using a cumulative distribution function and (3) finally using the Inversion Method, we can transform the uniform marginals to whatever distribution we like.

**5. The Risk Aggregation Example**

Coming back to our original point, the main benefit of copulas is that we can decompose joint probability distributions of the aggregate risk into their respective marginals and a function which couples them

together. This, therefore, allows us to define the correlation structure separately. The components of the joint distribution are completely separable thus also allowing for flexibility in the marginal distributions of the random variables. Copulas are able to create a dependency structure while preserving the original shape of the marginal distributions.

Risk Aggregation Example:

Suppose Bank X has 20 years of loss data for both their Retail and Commercial lines of business and would like to aggregate the losses to get an overall picture of the aggregate company losses. After some preliminary data analysis, they discover :

(1) the correlation between the two data series is 0.5 and

(2) the losses are distributed as such: Retail-Student-t (df = 5 ) and Commercial – Gamma (shape = 2, scale = 1).

The specific steps to the aggregate risk data are as such:

- Generate random samples from the distribution specified by the copula (in this example: the Gaussian copula).
- Draw a joint sample of uniform random variables

from the results specified in 1. - Translate the sample from the copula distribution into a sample from the conjoined loss distribution by calculating the -th percentile of , the -th percentile of , etc. (in vector form, this is ).
- Calculate the realised sample for the aggregate loss as the sum of the percentiles drawn from each distribution (ie ).
- Drawing many samples for the aggregate loss distribution will produce a simulated distribution. Any measure of risk (such as VaR or expected shortfall) can be computed from this simulated distribution.

Where is the code for step 3?