Skip to content
Prev 8576 / 15274 Next

portfolio.optim

Hi <anonymous>,

just build a covariance matrix with your correlation and pass it to 
'portfolio.optim'. For instance, for 4 assets:

## marginal vols
vols <- c(0.2, 0.3, 0.4, 0.5)

## correlation matrix
C <- array(0.42, dim = c(length(vols), length(vols))); diag(C) <- 1

## covariance matrix
Sigma <- diag(vols) %*% C %*% diag(vols)

## ...or more efficiently
Sigma <- outer(vols, vols) * C


Regards,
Enrico


Am 24.09.2011 22:47, schrieb sixstringaddict: