6
$\begingroup$

Given a positive semi-definite $n\times n$ matrix $C$ I would like to construct $n$ random variables $X_1,\dots,X_n$ drawn from $n$ fixed distributions such that $\mathrm{corr}(X_i,X_j) = C_{ij}$. I am particularly interested in the case when $X_i$ are drawn from triangular distributions with varying parameters. I have read about two approaches

  1. Cholesky decomposition: this seems appropriate to transform from uncorrelated sample to correlated samples. However, linear combinations of triangular distributions are no longer triangular
  2. Using the cdf to transform the distributions to uniform or normal distributions, but this does not seem to preserve correlations

Is there any way how these approaches can be combined to guarantee that the random variables both obey the correlation and distribution condition? Suggestions for implementation in python are also appreciated

$\endgroup$
4
  • 1
    $\begingroup$ Another word to add to your search is "copula". Maybe check out flr-project.org/FLa4a/reference/mvrtriangle.html, or for a python package sdv.dev/Copulas/index.html $\endgroup$
    – Andy W
    Apr 8 at 13:50
  • $\begingroup$ It depends on what you might mean by "triangular distributions with varying parameters." One sense is that a triangular distribution arises by summing two independent Uniform(0,1) variables and the "parameters" are a location and scale. Because those parameters do not affect correlations, varying the parameters is irrelevant. Moreover, because a triangular distribution is close to Normal for these purposes, your method (2) works remarkably well. Could you therefore please clarify your meaning? $\endgroup$
    – whuber
    Apr 8 at 15:31
  • 1
    $\begingroup$ By parameters I mean the min, max and mode of the triangular distributions. Varying parameters just wanted to say that the variables are not necessarily identically distributed. So $X_1$ and $X_2$ would both follow a triangular distribution, but with different min,max and mode in general. $\endgroup$
    – deepfloe
    Apr 9 at 14:23
  • $\begingroup$ The min and max are irrelevant, because a change of location and scale can always make them equal to 0 and 1 without changing any correlations. Varying the mode is a complication that I believe is sufficiently severe that all you can hope for are approximate numerical solutions. Nevertheless, if the modes typically are near 1/2, my earlier comment applies: you will likely find that method (2) gives excellent results. $\endgroup$
    – whuber
    Apr 10 at 15:33

1 Answer 1

6
$\begingroup$

This is related to the following Math.SE questions: Joint distribution given marginals and correlation and How does one generally find a joint distribution function (or density) from marginals when there is dependence?. Knowing the marginal triangular distributions and the corresponding correlation structure does not uniquely characterize the joint distribution. When the joint is not uniquely determined, what is the distribution you want to draw from? This basically means you do not know the underlying distribution.

This is (one of the many) nice properties of the normal distribution. For this distribution, knowing the marginals and correlation structure is sufficient for characterizing the joint distribution. You can then easily draw samples from the joint using the Cholesky decomposition.

$\endgroup$
1
  • $\begingroup$ Thank you, reading on copulas made me appreciate the ambiguity of the joint distribution. To make sure my understanding is correct: Even for normal marginals and given covariance the joint distribution is not unique, we could use non-Gaussian copulas and apply Sklar's theorem. It just happens that for normal marginals there is one canonical choice, but it's not unique. Do you agree? $\endgroup$
    – deepfloe
    Apr 12 at 9:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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