Skip to content

portfolio.optim

2 messages · sixstringaddict, Enrico Schumann

#
I am using the portfolio.optim function to find the portfolio weights and
risk using three covariance estimates.

I'm using the following function:
portfolio.optim(rr,target,covmat=cov(rr),riskless=T,rf=.001,shorts=T)

Now I need to find the weight and risk but this time I need to use a
specific correlation coefficient, which is in this case 0.4210423. Is there
a way of doing this?

--
View this message in context: http://r.789695.n4.nabble.com/portfolio-optim-tp3840249p3840249.html
Sent from the Rmetrics mailing list archive at Nabble.com.
#
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: