# [R] Generate random numbers with nested Archimedean Copula

Kellner ralf.kellner at wiso.uni-erlangen.de
Thu Jul 12 11:36:23 CEST 2012

```Hi everybody,

I try to simulate random numbers from a trivariate nested Archimedean
copula. My aim is to correlate two processes with, e.g. theta2, as the so
called child pair and then to correlate these two processes with a third one
with theta1 (parent). This "figure" tries to capture what I am explaining

theta1

theta2               x1

x2                  x3

I try to follow McNeil (2006)

http://www.ma.hw.ac.uk/~mcneil/ftp/NestedArchimedean.pdf

with R as the programming language. My code so far is as follows:

n = 10000

#parent
tau1 = 0.60
theta1 = (2*tau1)/(1-tau1)

#child
tau2 = 0.80
theta2 = (2*tau2)/(1-tau2)

#parent
V1 = rgamma(n, 1/theta1,1)

#child
V2 = rgamma(n, 1/theta2,1)

u1 = runif(n)
u2 = runif(n)
u3 = runif(n)

u = cbind(u2,u3)

#Create bivariate child copula
u.inner = (1-log(u)/V2)^(-1/theta2)

#Child inner generator
u.inner2 =exp(V1 - V1*(1 + (-log(u.inner)/V1))^(theta1/theta2))

#Create parent copula
u.c = cbind(u1,u.inner2)
u.ch = 1/((-log(u.c)/V1) + 1)^(1/theta1)

Kendall's tau between u2,u3 should equal 0.60 and 0.80 among u1,u2 and
u1,u3.

My results are 0.60 between u2,u3 but unfortunately 0.87 among u1,u2 and
u1,u3.

Does anyone see my mistake or can anyone give me a hint how to create the
nested copula?