# Solved – Simulate a Gaussian Copula with t margins

Given is \$Z_1,…Z_{50}\$ different hypothetical assets.

Each \$Z_k sim t_3\$ with standard deviation \$sigma=0.01\$ and \$tau(Z_i,Z_k)=0.4\$ for \$jneq k\$.

I want to simulate from the distribution \$(Z_1,…,Z_{50})\$ assuming that it has a Gaussian Copula with \$t_3\$ margins.

For what I understand, from the kendals tau \$tau\$ I can estimate the correlation parameter \$rho=sin(pitau/2)=0.5878\$. From this I can determina the covariance matrix when I do want to do the simulation. Here is the code:

``require(mvtnorm) N <- 1000 tau <- 0.4 correlation <- sin(pi*tau/2) std <- 0.01  S <- matrix((std^2)*correlation,50,50 for (i in 1:50) {          S[i,i] <- std^2  }  gauss <- rmvt(N, sigma = S, df = 3) U_norm <- pnorm(gauss) Z_gauss <- qt(U_norm,df=3) plot(Z_gauss[,1],Z_gauss[,2]) ``

However, this method is not correct. I cannot see any plot that resembles a gaussian copula. Any thoughts, corrections?

Contents

There's an R package called "copula" that will let you do exactly this.

The process goes:

1. Specify a copula

2. Specify the population distribution, including whatever marginals you want. From the documentation: "A user-defined distribution, for example, fancy, can be used as margin provided that `dfancy`, `pfancy`, and `qfancy` are available."

3. Generate samples from that multivariate distribution.

For you, you would specify a Gaussian copula in step 1 and then say that you want t-distributed marginals in step 2.

``# Step 1 # my_copula <- normalCopula(0.8)  # Step 2 # my_population <- mvdc(my_copula, c("t","t"),list(t=3,t=3))  # Step 3 # my_sample <- rMvdc(1000,my_population) ``

Caveat: I don't have access to this package right now, so I can't swear that this will compile, though it gives the gist of what to do.

Rate this post