[R-SIG-Finance] portfolio.optim

Enrico Schumann enricoschumann at yahoo.de
Sun Sep 25 09:14:34 CEST 2011


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:
> 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.
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
>

-- 
Enrico Schumann
Lucerne, Switzerland
http://nmof.net/



More information about the R-SIG-Finance mailing list