[R-sig-finance] Long-short balanced portfolio optimization

KAHRA HANNU hannu.kahra at mpsgr.it
Tue May 31 10:57:09 CEST 2005


Jeff,

here is the code I mentioned on Friday. The example is taken from Scherer's book. For some reason, I do not get exactly the same solution.

> benchmark.relative.portfolio <- function(lamda,covmat,returns)
+ {
+     n <- dim(covmat) [2]
+     U <- rep(1,n)
+     return(lamda*solve(covmat)%*%(returns-U%*%solve(t(U)%*%solve(covmat)%*%U)%*%t(U)%*%solve(covmat)%*%returns))
+ }
> 
> omega <- c(0.04,0.0252,0.0036,0.0024,0.0025,0.0441,0.0038,0.0025,0.0036,0.0038,0.0036,0.0014,0.0024,0.0025,0.0014,0.0016)
> omega <- matrix(omega,nrow=4,ncol=4,byrow=T)
> mu <- c(4,3,2,1)
> 
> 
> w <- benchmark.relative.portfolio(1,omega,mu/100)
> w
           [,1]
[1,]  0.4582752
[2,]  0.3651081
[3,]  3.6711469
[4,] -4.4945302
> sum(w)
[1] -1.110223e-15

This is in fact tracking error optimisation. The TE optimisation is obtained as a special case of the general mean-variance optimisation by applying utility maximization and by fixing the values of the linear constraints Aw = b. In the solution A = 1' and b = 0. The solution applies self-financing constraints such that the over- and underweights sum to zero. Lamda is a measure of risk tolerance ("aggressiveness") that scales the optimal weights up or down. Note that we do not need any information on the benchmark portfolio when applying the optimizer.

Regards, 

Hannu Kahra 
Progetti Speciali 
Monte Paschi Asset Management SGR S.p.A. 
Via San Vittore, 37
IT-20123 Milano, Italia 

Tel.: +39 02 43828 754 
Mobile: +39 333 876 1558 
Fax: +39 02 43828 247 
E-mail: hannu.kahra at mpsgr.it 
Web: www.mpsam.it 



-----Original Message-----
From: r-sig-finance-bounces at stat.math.ethz.ch
[mailto:r-sig-finance-bounces at stat.math.ethz.ch]On Behalf Of Jeff Enos
Sent: Friday, May 27, 2005 11:44 PM
To: roger bos
Cc: r-sig-finance at stat.math.ethz.ch
Subject: Re: [R-sig-finance] Long-short balanced portfolio optimization


Thanks for all the responses to my question -- I've summarized
suggestions below.

1. Thanks to Brendan McMahon and Patrick Burns for pointing me toward
POP at www.burns-stat.com.

2. Hannu Kahra suggests looking at Bernd Scherer's book "Portfolio
Construction and Risk Budgeting" which frames the issue from a
benchmark-relative optimization/tracking error perspective.

3. Roger Bos suggests editing portfolio.optim, replacing the first
element of b0 with 0 to reflect the equality constraint sum(weights)
== 0 before passing along to solve.QP; I assume he means in the risky
lending/borrowing case.

This is an attractive solution, but I haven't been able to prove to
myself yet that it's correct.

4. Robert McGehee provides a different approach altogether:

"My solution to adding net exposure constraints (such as sum(weights)
== 0) was to add a security called "cash" with an alpha of the
risk-free rate (or 0) and no covariance with my other securities. I
then would put an upper and lower bound on the cash holdings, which
works out the same as an upper and lower bound on net exposure, since
being net long is the same as selling cash for stock and being net
short is the same as buying cash for stock. That is, if we don't allow
cash to change, then we can't be net long or short."

Is this solution achievable by merely adding two additional inequality
constraints (and the additional asset) to the standard quadratic
program in portfolio.optim?

Again, thanks for these responses and any further insight and
clarification.

Jeff




On 5/27/05, Jeff Enos <jeff at kanecap.com> wrote:
> R-sig-finance,
> 
> I have a vector of expected returns and a covariance matrix and would
> like to perform mean-variance portfolio optimization with the
> constraint that the portfolio be long-short balanced, that is,
> sum(weights) == 0.
> 
> It doesn't look like portfolio.optim in the tseries package supports
> this constraint -- has anyone already solved this problem somewhere
> I've missed?
> 
> Thanks,
> 
> Jeff

_______________________________________________
R-sig-finance at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance



More information about the R-sig-finance mailing list