Contents
- 1 How to Generate Correlated Random Numbers
- 1.1 Precise Problem Definition
- 1.2 Special Cases
- 1.2.1 Cholesky Decomposition
- 1.2.2 Singular Value Decomposition
- 1.2.3 Prespecified Linear Models
- 1.3 Box–Muller transform
- 2 Copulas
- 2.1 The Student-t Copula
- 3 Archimedean Copulas
- 4 Empirical Copula
- 5 Applications
- 6 Implementation
How to Generate Correlated Random Numbers
Generation of correlated random numbers is of wide applicability in many domains of quantitative analysis and risk modelling. This article is a review of approaches.
Precise Problem Definition
The more precisely defined question is how to generate random numbers
Special Cases
The most commonly encountered special case is that of multivariate normal distribution given by the density:
For the purposes of this article will ignore non-zero means and non-unit (unscaled) variances as those aspects can be handled on a univariate basis. We will focus on the Correlation Matrix.
In general the methodologies involve generating realizations of the random (vector)
Cholesky Decomposition
Given the variance-covariance matrix
Upon simulation of random vectors
where L is a lower triangular matrix that is effectively the "square-root" of the correlation matrix
Singular Value Decomposition
When the correlation matrix is estimated empirically it may be the case that it fails to be positive semi-definite, in which case the Cholesky decomposition may fail. One option is to adjust the correlation matrix. Another option is to pursue a singular value decomposition
Then
Prespecified Linear Models
It is not always the case that our input data or modelling framework is based on covariance matrix. If the dependency between dependent variables is explicitly derived in terms of a multi-factor model wher the factors
The simplest example being the case
Box–Muller transform
The wikipedia:Box–Muller transform is an interesting special case, primarily of interest for educational purposes. In the first step uncorrelated normal numbers are generated via
Those can then be combined as per the formulas of the previous section on linear models
Copulas
In various applications the multi-variate dependency cannot be assumed to be a Gaussian. In this case we require to have a specified copula which provides for more general dependency structures.
The copula of
The Student-t Copula
This is a special copula as it is linked to the Gaussian distribution
Archimedean Copulas
- Clayton
- Gumbel
- Frank
Empirical Copula
Applications
- Monte Carlo Simulation of Credit Portfolios
Implementation
A list of open source implementations
XXX | Python | TD |
XXX | R | TD |
XXX | C++ | TD |
XXX | Julia | TD |