# What are some techniques for sampling two correlated random variables?

What are some techniques for sampling two correlated random variables:

• if their probability distributions are parameterized (e.g., log-normal)

• if they have non-parametric distributions.

The data are two time series for which we can compute non-zero correlation coefficients. We wish to simulate these data in the future, assuming the historical correlation and time series CDF is constant.

For case (2), the 1-D analogue would be to construct the CDF and sample from it. So I guess, I could construct a 2-D CDF and do the same thing. However, I wonder if there is a way to come close by using the individual 1-D CDFs and somehow linking the picks.

Thanks!

-

2
– onestop Feb 22 '11 at 20:59

## 1 Answer

I think what you're looking for is a copula. You've got two marginal distributions (specified by either parametric or empirical cdfs) and now you want to specify the dependence between the two. For the bivariate case there are all kinds of choices, but the basic recipe is the same. I'll use a Gaussian copula for ease of interpretation.

To draw from the Gaussian copula with correlation matrix $C$

1) Draw $(Z=(Z_1, Z_2)\sim N(0, C)$

2) Set $U_i = \Phi(Z_i)$ for $i=1, 2$ (with $\Phi$ the standard normal cdf). Now $U_1, U_2\sim U[0,1]$, but they're dependent.

3) Set $Y_i = F_i^{-1}(U_i)$ where $F_i^{-1}$ is the (pseudo) inverse of the marginal cdf for variable $i$. This implies that $Y_i$ follow the desired distribution (this step is just inverse transform sampling).

Voila! Try it for some simple cases, and look at marginal histograms and scatterpolots, it's fun.

No guarantee that this is appropriate for your particular application though (in particular, you might need to replace the Gaussian copula with a t copula) but this should get you started. A good reference on copula modeling is Nelsen (1999), An Introduction to Copulas, but there are some pretty good introductions online too.

-

+1 Nelsen is quite readable.  I bought a copy a few years ago even after going through a lot of the online materials. – whuber♦ Feb 22 '11 at 21:36
I found a great tutorial paper and accompanying spreadsheet: behan.ws/copula.pdf and  soa.org/files/xls/rsrch-copula-ex.xls – Pete Mar 7 '11 at 15:33
@Pete, the paper is indeed nice. The spreadsheet link, on the other hand, is dead – bgbg Sep 17 '12 at 12:59
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 10, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9089577198028564, "perplexity_flag": "middle"}