# [R-SIG-Finance] mean-(scalar) portfolio optimization

Patrick Burns patrick at burns-stat.com
Wed Aug 23 19:01:11 CEST 2006

```Brian,

You are misunderstanding 'optim' -- it optimizes
a function over one argument but that argument can be
a vector.

However the utilities that you mention are hard to
optimize.  See 'A Data-driven optimization heuristic
for downside risk minimization' by Gilli et al.

Patrick Burns
patrick at burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

Brian G. Peterson wrote:

>The R function solve.QP is used by several authors to solve classic
>Markowitz mean-variance optimization using solve.QP and a covariance
>matrix.
>
>Many other classes of portfolio optimization solve for the weighting
>vector w using a scalar measure of risk, such as VaR, Sortino, Omega,
>etc.
>
>Basically, this class of problems could be expressed as:
>
>let w' be the desired portfolio weights
>let R be a set of returns for various instruments
>
>solve for a weighting vector w such that risk is minimized
>
>w' = min(risk(R))
>
>solve for a weighting vector w such that return is maximized over risk
>budget y
>
>w'=max(mean(R)) such that risk(R)<.05
>
>and other similar formulations.
>
>solve.QP does not appear to be appropriate for these kinds of
>optimization.  The functions 'optim' and 'optimize' seem to return scalar
>values, solving only for a single minima or maxima, and not for the
>vector (although I may be misunderstanding them).
>
>Does anyone have any pointers on how you might go about solving these
>kinds of optimization problems in R?  I apologize if this is a simple
>problem that I haven't been able to find a reference for online. I will
>happily post the optimizer code once it's working.
>
>Thank you,
>
>  - Brian
>
>_______________________________________________
>R-SIG-Finance at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>
>
>
>

```