I'm trying to solve portfolio problem with minimising its Expected shortfall, assuming the returns follow a stable distribution. If I'm able to calculate MLE fit to the series, calculate expected shortfall of that instrument, then how would I optimise the portfolio? I've read for instance here it is then linear programming problem.

I've tried to calculate ES of each of my instrument and then optimize the objective function weights*ES, but I always get minimum for vector weights 0, which makes sense, that's when its lowest. But that's of course not what I want, what is it that I'm missing? Is it good idea to take code which calculates this for normally distributed returns and just replace the function which calculates the actual ES?

Thanks a lot

  • $\begingroup$ You need a constraint $w^T e = 1$ (see Page 108) to force the sum of the weights to be 1, i.e. to make the "all weights equal zero" solution infeasible. $\endgroup$
    – Alex C
    Nov 18, 2017 at 20:25
  • $\begingroup$ The hyperlink in your post is not working anymore. Do you recall what paper it linked to? $\endgroup$
    – arni
    Oct 4, 2021 at 5:20
  • $\begingroup$ Through wayback machine I found it as: Yamai, Yasuhiro, and Toshinao Yoshiba. "Comparative analyses of expected shortfall and value-at-risk: their estimation error, decomposition, and optimization." Monetary and economic studies 20.1 (2002): 87-121. $\endgroup$
    – Jan Sila
    Oct 4, 2021 at 17:02

1 Answer 1


The ES of the optimized portfolio is (except in trivial cases) not the same as the weighted sum to the ES of the individual instruments; your objective function should be the expected shortfall of the weighted sum of the losses, not the weighted sum of the expected shortfalls of the individual instruments. (So it is an integral over the weighted sum of instrument losses.) This is equation (20) or (21) in the paper you linked. Minimization is facilitated by breaking this into two pieces (shown as equations (22) and (23)) by introducing the auxiliary variables $z_i$.

There are two other constraints. One is the constraint on the sum of the weights (mentioned by a Alex C above); this is equation (25). The other is the constraint that the portfolio delivers a desired level of return, equation (24). The optimization program you want is analogous to equations (22)-(25) in the doc you linked.

It's really a pretty amazing thing that minimizing expected shortfall is numerically feasible. That insight is due to Rockafellar and Uryasev (and these papers are mostly available online link1); but getting from an intuitive description of the problem to the operational form of the programming problem isn't as pretty as you would like! On operationalization, however, I found these slides by Guy Yollin invaluable: http://www.r-programming.org/files/RFinance2009.pdf

  • $\begingroup$ Hi, that looks really good! Thanks for this, I will try to implement it now. $\endgroup$
    – Jan Sila
    Nov 19, 2017 at 10:58
  • $\begingroup$ Do I understand correctly, in the equation 22, z_{j} = (Sum by i X_{ij}*w_{i}-Beta)+ ? Also if I set up the problem as calculating some portfolio weights, for those estimate the distribution function of the weighted observations, and on that calculate the ES of that, would that be ok ? I'm wondering if that's linear in the weights ? $\endgroup$
    – Jan Sila
    Nov 19, 2017 at 17:24
  • $\begingroup$ I think I've got it all working, looks as it all checkout. Thanks for the Yollin slides, mate! :) $\endgroup$
    – Jan Sila
    Nov 19, 2017 at 18:46
  • 1
    $\begingroup$ Sorry I didn't get back on your last question; I don't think I got the gist. I'm glad you got something working. I think this is a promising method. Good luck! (Thanks for the bump, too.) $\endgroup$
    – Drew
    Nov 21, 2017 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.