2.2 Computing Value-at-Risk with Copulas

Now that we have given the most important properties of copulas, we turn to the practical question of how to compute the Value-at-Risk of a portfolio using copulas. The following steps need to be performed:


2.2.1 Selecting the Marginal Distributions

The copula method works with any given marginal distribution, i.e. it does not restrict the choice of margins. However, we will use normal margins for simplicity and in order to allow a comparison with standard VaR methods.


2.2.2 Selecting a Copula

A wide variety of copulas exists, mainly for the two dimensional case (Nelsen (1999)). In our numerical tests, we will use some of the copulas presented in Table 4.1 of Nelsen (1999) in our experiments for comparison which are implemented in the function



C
= 6057 VaRcopula (uv,theta,0,copula)
returns $ C_\theta(u,v)$ for copula copula with parameter $ \theta =$ theta. uv is a $ n \times 2$ vector of coordinates, where the copula is calculated.

For easy reference the implemented copulas are given in Table 2.1.

Table: Copulas implemented in the VaR quantlib.
# $ C_\theta(u,v)=$ $ \theta\in$
1 $ \max\Big([u^{-\theta}+v^{-\theta}-1]^{-1/\theta},0\Big)$ $ [-1,\infty)\backslash\{0\}$
2 $ \max\Big(1-[(1-u)^{\theta}+(1-v)^{\theta}-1]^{1/\theta},0\Big)$ $ [1,\infty)$
3 $ {uv\over 1-\theta(1-u)(1-v)}\Big.$ $ [-1,1)$
4 $ \Big.\exp\left(-[(-\ln u)^\theta+(-\ln v)^\theta]^{1/\theta}\right)$ $ [1,\infty)$
5 $ - {1\over\theta}\ln\left(1+{(e^{-\theta u}-1)(e^{-\theta v}-1)\over e^{-\theta}-1}\right)$ $ (-\infty,\infty)\backslash\{0\}$
6 $ 1-\Big[(1-u)^\theta+(1-v)^\theta-(1-u)^\theta(1-v)^\theta)\Big]^{1/\theta}$ $ [1,\infty)$
7 $ \max\Big[\theta uv+(1-\theta)(u+v-1),0\Big]$ $ (0,1]$
8 $ \max\Big[{\theta^2uv-(1-u)(1-v)\over \theta^2-(\theta-1)^2(1-u)(1-v)},0\Big]$ $ (0,1]$
9 . $ uv\exp(-\theta \ln u \ln v)$ $ (0,1]$
10 $ uv/\Big[1+(1-u^\theta)(1-v^\theta)\Big]^{1/\theta}$ $ (0,1]$
11 $ \max\Big(\Big[u^\theta v^\theta-2(1-u^\theta)(1-v^\theta)\Big]^{1/\theta},0\Big)$ $ (0,1/2]$
12 $ \Big(1+\Big[(u^{-1}-1)^\theta+(v^{-1}-1)^\theta\Big]^{1/\theta}\Big)^{-1}$ $ [1,\infty)$
13 $ \exp \Big(1- \Big[ (1-\ln u)^\theta + (1-\ln v)^\theta -1 \Big]^{1/\theta} \Big)$ $ (0,\infty)$
14 $ \Big( 1+ \Big[ (u^{-1/\theta} -1)^\theta + (v^{-1/\theta} -1)^\theta \Big]^{1/\theta} \Big)^{-\theta}$ $ [1,\infty)$
15 $ \max \Big( \Big\{ 1- \Big[ (1-u^{1/\theta})^\theta + (1-v^{1/\theta})^\theta
\Big]^{1/\theta} \Big\}^\theta ,0 \Big)$ $ [1,\infty)$
16 $ {1 \over 2} \Big( S + \sqrt{S^2 + 4 \, \theta} \Big) $ $ [0,\infty)$
  $ \hookrightarrow S=u+v-1- \theta \Big( {1 \over u}+{1 \over v}-1 \Big)$  
21 $ 1- \Big( 1- \big\{ \max(S(u) + S(v) -1, 0) \big\}^\theta\Big)^{1\over\theta}$ $ [1,\infty)$
  $ \hookrightarrow S(u)=\Big[1-(1-u)^\theta\Big]^{1/\theta}$  



2.2.3 Estimating the Copula Parameters

After selecting a copula we fit the copula to a time series

$\displaystyle s=s^{(1)},\dots,s^{(T)} \textrm{ with }
s^{(t)}=(s_1^{(t)},\dots,s_n^{(t)})$

for $ t\in{1,\dots,T}$. For simplicity we assume that the $ s^{(t)}$ are realizations of i.i.d. random variables $ S^{(t)}$. The first step will be to determine the parameters of the marginal distributions. In the numerical example we will use the normal distribution $ \textrm{N}(0,\sigma_i^2)$, and estimate the volatility $ \sigma_i$ using an equally weighted volatility estimator $ \hat {\sigma}^2_i={1\over T-1}\sum_{t=2}^{T} ( r^{(t)}_i )^2$ of the returns $ r_i^{(t)}=\log ({s_i^{(t)} / s_i^{(t-1)}})$ for simplicity. The marginal distributions of the risk factors are then log-normal. The remaining task is to estimate the copula parameters. In the XploRe   VaR quantlib this is done by the function



res
= 6264 VaRfitcopula (history,copula,method)
fits the copula to the history using fitting function method. The result res is a list containing the estimates of the copula parameter together with there standard deviations.

2.2.3.0.1 Least Square Fit

The main idea of the least square fit is that the cumulative distribution function $ F^{(C)}_{\theta}(x)$ defined by the copula $ C$ should fit the sample distribution function $ S(x)={1\over T}\sum_{t=1}^T \boldsymbol{1}(s_1^{(t)}\le x_1,\dots,s_n^{(t)}\le x_n)$ as close as possible in the mean square sense. The function $ \boldsymbol{1}(A)$ is the indicator function of the event $ A$. In order to solve the least square problem on a computer, a discretization of the support of $ F^{(C)}_{\theta}$ is needed, for which the sample set $ {s}^{(t)}$ seems to be well suited. The copula parameter estimators are therefore the solution of the following minimization problem:

$\displaystyle \min \sum_{t=1}^T \left(F^{(c)}_{\theta}({s}^{(t)})-S({ s}^{(t)})+{1\over 2T}\right)^2\\
\textrm{ subject to}\;\; \theta \in D_C \, .
$

using the Newton method on the first derivative ( $ {\tt method}=1$). The addition of $ {1\over 2T}$ avoids problems that result from the $ 1\over T$ jumps at the sample points. While this method is inherently numerically stable, it will produce unsatisfactory results when applied to risk management problems, because the minimization will fit the copula best where there are the most datapoints, and not necessarily at the extreme ends of the distribution. While this can be somewhat rectified by weighting schemes, the maximum likelihood method does this directly.

2.2.3.0.2 Maximum Likelihood

The likelihood function of a probability density function $ f^{(C)}_{ \theta}({ x})$ evaluated for a time series $ { s}$ is given by $ l(\theta)=\prod_{t=1}^T f^{(C)}_{ \theta}({ s}^{t})$. The maximum likelihood method states that the copula parameters at which $ l$ reaches its maximum are good estimators of the ``real'' copula parameters. Instead of the likelihood function, it is customary to maximize the log-likelihood function

$\displaystyle \max \sum_{t=1}^T \log\left(f^{(C)}_{ \theta}({ x}^{(t)})\right)
\textrm{ s.t.} \;\; \theta \in D_C \, .
$

Maximization can be performed on the copula function itself by the Newton method on the first derivative (method=2) or by an interval search (method=3). The true maximum likelihood method is implemented in method=4 using an interval search. Depending on the given copula it may not be possible to maximize the likelihood function (i.e. if $ f^{(C)}_\theta({ s}^{(t)}))=0$ for some $ t$ and all $ \theta $. In this case the least square fit may be used as a fallback.


2.2.4 Generating Scenarios - Monte Carlo Value-at-Risk

Assume now that the copula $ C$ has been selected. For risk management purposes, we are interested in the Value-at-Risk of a position. While analytical methods for the computation of the Value-at-Risk exist for the multivariate normal distribution (i.e. for the Gaussian copula), we will in general have to use numerical simulations for the computation of the VaR. To that end, we need to generate pairs of random variables $ (X_1,X_2)\sim F^{(C)}$, which form scenarios of possible changes of the risk factor. The Monte Carlo method generates a number $ N$ of such scenarios, and evaluates the present value change of a portfolio under each scenario. The sample $ \alpha-$quantile is then the one period Value-at-Risk with confidence $ \alpha$.

Our first task is to generate pairs $ (u,v)$ of observations of $ U(0,1)$ distributed random variables $ U$ and $ V$ whose joint distribution function is $ C(u,v)$. To reach this goal we use the method of conditional distributions. Let $ c_u$ denote the conditional distribution function for the random variable $ V$ at a given value $ u$ of $ U$,

$\displaystyle c_u(v) \stackrel{\mathrm{def}}{=}\textrm{P}(V \le v, U=u) \; .$ (2.15)

From (2.6) we have

$\displaystyle c_u(v) = \lim_{\Delta u \to 0} \frac{C(u + \Delta u,v) - C(u,v)}{\Delta u} = \frac{\partial }{\partial u} C(u,v) = C_u(v) \; ,$ (2.16)

where $ C_u$ is the partial derivative of the copula. From Theorem 2.4 we know that $ c_u(v)$ is nondecreasing and exists for almost all $ v \in [0,1]$.

For the sake of simplicity, we assume from now on that $ c_u$ is strictly increasing and exists for all $ v \in [0,1]$. If these conditions are not fulfilled, one has to replace the term ``inverse'' in the remaining part of this section by ``quasi-inverse'', see Nelsen (1999).

With result (2.16) at hand we can now use the method of variable transformation to generate the desired pair $ (u,v)$ of pseudo random numbers (PRN). The algorithm consists of the following two steps:

It may happen that the inverse function cannot be calculated analytically. In this case one has to use a numerical algorithm to determine $ v$. This situation occurs for example when Gumbel-Hougaard copulas are used.


v
= 6442 VaRcopula (uv,theta,-1,copula)
returns inverse $ v=c_u^{-1}$ such that $ res=c_u(u,v)$ for copula copula with parameter $ \theta =$ theta. uv is a $ n \times 2$ vector of coordinates, where the copula is calculated.

Finally we determine $ x_1 = \Phi_1^{-1}(u)$ and $ x_2 = \Phi_2^{-1}(v)$ to obtain one pair $ (x_1, x_2)$ of random variables with the desired copula dependence structure. For a Monte Carlo simulation, this procedure is performed $ N$ times to yield a sample $ {X}=({x}^{(1)},\dots,{x}^{(N)}$).



X
= 6458 VaRsimcopula (N, sigma_1, sigma_2, theta, copula)
returns a sample of size N for the copula copula with parameter $ \theta =$ theta and normal distributions with standard deviations $ \sigma_1 =$ sigma_1, $ \sigma_2 =$ sigma_2.

If we assume a linear position $ a$ with holdings $ a_1,\dots,a_n$ in each of the risk factors, the change in portfolio value is approximately $ \sum_{i=1}^n a_i\cdot x_i$. Using a first order approximation, this yields a sample Value-at-Risk with confidence level $ \alpha$.



VaR
= 6477 VaRestMCcopula (history,a,copula,opt)
fits the copula copula to the history history and returns the N-sample Monte Carlo Value-at-Risk with confidence level $ \alpha =$ alpha for position a. N and alpha are contained in list opt.