Skip to content
Back to formatted view

Raw Message

Message-ID: <4E7ED4DA.4030808@yahoo.de>
Date: 2011-09-25T07:14:34Z
From: Enrico Schumann
Subject: portfolio.optim
In-Reply-To: <1316897244044-3840249.post@n4.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:
> 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/