# How can I sample from a copula with a given correlation in python?

How can I sample from a normal copula with a given correlation in python?

I know how to sample from a multivariate normal distribution with a given covariance matrix using numpy and scipy, but I don't know how to generate and sample from a copula with a given correlation.

• look up the Cholesky inversion method. extending it to copulas just needs the usual uniform marginal transformations of copulas Aug 26 '20 at 17:03
• Note that questions about code are off topic. If you need guidance on that, you'll need to ask on stackoverflow
– mkt
May 1 at 18:12
• I actually think there’s a statistics question hidden in here, chiefly the relationship between the parameters of a Gaussian copula and correlation between the marginal distributions.
– Dave
May 1 at 18:20

## 1 Answer

It's actually straight forward then:

If you have simulated some random variables $$(X_1,X_2)$$ which are normally distributed with $$\sigma_1=\sigma_2=1$$ and correlation $$\rho$$ then $$(F(X_1),F(X_2))$$ are observations from the gauss copula. $$F(\cdot)$$ is this case the univariate standard normal cdf.