cm.rnorm.cor {CreditMetrics} | R Documentation |
cm.rnorm.cor
computes correlated standard normal distributed random numbers.
This function uses a correlation matrix rho
and later the cholesky
decompositon in order to get the correlated random numbers.
cm.rnorm.cor(N, n, rho)
N |
number of simulations |
n |
number of simulated random numbers |
rho |
correlation matrix |
This function computes standard normal distributed random numbers which include
the correlation matrix rho
. One has a random matrix Y which is
N(0,1) distributed. With the linear transformation X = μ + A Y
one gets X is N(μ, A A^T) distributed. If X should have
the correlation matrix Σ. By using the cholesky decomposition the
matrix A can be computed from Σ.
The function returns N
simulations with n
simulated random numbers
each which include the correlation matrix rho
.
Andreas Wittmann andreas_wittmann@gmx.de
Glasserman, Paul, Monte Carlo Methods in Financial Engineering, Springer 2004
N <- 3 n <- 50000 firmnames <- c("firm 1", "firm 2", "firm 3") # correlation matrix rho <- matrix(c( 1, 0.4, 0.6, 0.4, 1, 0.5, 0.6, 0.5, 1), 3, 3, dimnames = list(firmnames, firmnames), byrow = TRUE) cm.rnorm.cor(N, n, rho)