5
$\begingroup$

I am recently into copulas for finance, I've read several examples of how to generate dependent random variables with most kind of copulas. The problem for me is that all the books describe the case with 2 random variables $(X_1,X_2)$ but I want to generate $n$ dependent r.v. $(X_1,X_2,\ldots,X_n)$.

I find the case easy for gaussian copulas, since we just have to expand the correlation matrix, apply cholesky decomposition and calculate matrix multiplication.

But I couldn't find a way to apply this for the case of a clayton copula, since the book examples always use the conditional copula density of r.v. #1 to generate r.v. #2. This seems not like a practical approach for multi r.v.

Is there some approach like the one for the gaussian copula?

Best regards

$\endgroup$
  • 3
    $\begingroup$ The Clayton copula is an example of an Archimedean copula. Have a look at "Quantitative Risk Management" by Embrechts, Frey, McNeil Chapter 5.4.2 and 5.4.3. They define multivariate Archimedean copulas, provide simulation algorithms and give references to literature. $\endgroup$ – g g Jun 18 at 21:05
3
$\begingroup$

Since I think this is of interest for other people, I will post the approach I found:

First, let $C_n(u_1,\ldots,u_n)$ be a $n$ - dimensional Clayton copula with generator function $F$ and inverse $F^{-1}$. Then,

  1. Generate $n$ independent r.v. from $U (0,1)$

  2. Calculate $n-1$ derivatives of $F$, where $F_{n-1}$ denotes the $n-1$-th - order derivative of $F$

  3. Set $v_1 = u_1$

  4. Set $u_2 = C_2(v_2|v_1) = \frac{F_1(F^{-1}(v_1)+F^{-1}(v_2))}{F_1(F^{-1}(v_1)}$ and solve for $v_2$

  5. Repeat until $u_n = C_n(v_n|v_1,v_2,\ldots,v_{n-1)} = \frac{F_{n-1}(F^{-1}(v_1)+F^{-1}(v_2)+\ldots+F^{-1}(v_n))}{F_{n-1}(F^{-1}(v_1)+F^{-1}(v_2)+\ldots+F^{-1}(v_{n-1}))}$ and solve for $v_n$.

For the question regarding matlab code for simulating from gaussian copula, here some quick coding:

%% Simulations of bivariate Gaussian copulas 

%Example for rho=0.5
n=30000;
rho=0.5;
x1=norminv(rand(1,n));
x2=norminv(rand(1,n));
X = [x1; x2];

C = [1, rho; rho,1]; %2x2 Correlation matrix

cholesky = chol(C,'lower'); %lower triangular matrix of C using Cholesky decomposition

Copsims = cholesky*X;

c1 = Copsims(1,:);
c2 = Copsims(2,:);

plot(c1,c2,'.')

corrcoef(c1,c2) %check for empirical rho, not on point the initial rho because of sampling error
$\endgroup$
1
$\begingroup$

Clayton Copula-Matlab Code

    %% Simulations of Clayton copulas using conditional cdf

%Example for theta=4
n=3000;
theta=5;
u=rand(1,n);
y=rand(1,n);
v=((y.^(1/(1+theta)).*u).^(-theta)+1-u.^(-theta)).^(-1/theta);

x1=norminv(u);
x2=norminv(v);

plot(x1,x2,'.')

Though for me, Gaussian seems uneasy, can you share a code, on how to do Gaussian Copula in Matlab?

$\endgroup$
  • $\begingroup$ added some code to the original answer $\endgroup$ – simzoor Sep 18 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.