# Simulations with Factor Models or the Copula Approach

This chapter addresses classical simulation techniques based on factor models and explains the simulation of dependent variables using the copula approach. The prerequisite, in both cases, is the simulation of a random variable following a predefined distribution. This module is a common block to all simulation techniques.

Generating correlated random variables can be straightforward with factor models. The dependency of the simulated variables results from the common dependence to factors. The process relies on a linear relation between the explained variables, the factors and the residual. The relation allows generating correlated random factors and random residuals, and deriving the correlated explained variables, using the coefficient of the factor. This is straightforward for a single factor.

For several factors, we need to generate correlated factor values in addition to the residual. The technique is based on the Cholesky decomposition method. The method applies to any number of dependent variables complying with a variance-covariance matrix, provided that they are normally distributed. The Cholesky decomposition allows deriving from independent variables, simulated in a first step, the dependent variables as a linear function of such independent variables. The simulation process collapses to generating as many independent normal variables as necessary and deriving the dependent variables from the former independent normal variables, the coefficients of the linear relation resulting from the decomposition technique.

We apply the principle to the bivariate case using the Gaussian copula to pairs of variables. We consider various cases. The case of two uniform standard variables is a common building block for all other variables. We also implement the copula approach to normal variables, which is a parallel example to the former classical methodologies (factor models and Cholesky methodology). The case with most interest is that of the simulation of dependent times to default, since they follow a non-normal distribution, namely an exponential distribution.

Section 34.1 describes the common module for simulating a random variable using the inverse function and inputting standard uniform random number.

Section 34.2 deals with single one-factor models for generating simulations of a correlated pair of normally distributed variables. The principles for simulating variables from factor models consist of simulating random variables for each factor and another variable that represents the residual of the factor model. If we ignore cross-correlations across residuals, each residual is an independent normal variable. The process is extremely simple with a single factor, used as an example in a first step. If we need to generate correlated normal variables, the Cholesky methodology applies. It starts from as many independent normal variables as necessary and transforms them into dependent variables complying with variance-covariance matrix by making them linear functions of the independent variables. The coefficients depend on the Cholesky methodology. The technique is implemented in this section with two variables first, when the coefficients are easily derived, and to a larger number of variable. The Cholesky methodology principle is the main text, while the details are provided in the appendix (Section 34.7). A summary of the methodology for factor model-based simulations is provided.

Section 34.3 deals with simulation based on the copula approach. The basic principle is simple: the problem of simulating TV dependent variables following the univariate *F,* which can be normal but need not be, becomes the problem of simulating TV uniform standard variables, following *U(0,* 1), with the same dependency. Once this principle is revisited, the simulation algorithm follows. It is based on simulating random independent uniform variables, then plugging in the dependency relation for finding a third uniform standard dependent variable. Once we have two dependent uniform standard variables, we revert to the target variables by inverting the simulated values of the two dependent uniform standard variables.

Subsequent sections provide examples. Section 34.4 deals with the common module to simulations, which consists of generating two dependent uniform variables. Section 34.5 uses the methodology for normal variables for the simple purpose of comparing the procedure with the above Cholesky classical methodology. The final section (Section 34.6) uses the copula approach for simulated dependent times to default. All steps are the same in all three approaches, but only the last example shows the complete set of steps making up the simulation algorithm. Section 34.6 applies to non-normal distributions, using the case of exponentially distributed times to defaults. This last case is used subsequently for modeling default for credit portfolio models.

FIGURE 34.1 **Relationship between a random variable **X **and its percentile ***u = P(X<x)*