First four moments utility

Task

Perform a scenario optimization that maximizes a linear combination of the first four moments of the return distribution.

Preparation

You need:

  • a three-dimensional array containing scenarios
  • Portfolio Probe
  • the pprobeSup package

The pprobeSup package needs to be loaded into your R session:

require(pprobeSup)

If pprobeSup is not installed on your machine, then you can get it with:

install.packages("pprobeSup", 
   repos="https://www.portfolioprobe.com/R")

or alternatively with:

install.packages("pprobeSup", 
   repos="https://www.portfolioprobe.com/R", 
   type="source")

You also need to have the Portfolio Probe package loaded into your R session:

require(PortfolioProbe)

If you don’t have Portfolio Probe, see “Demo or Buy”.

Doing the example

You need to have the pprobeData package loaded into your R session:

require(pprobeData)

This package may be installed from the same repository as pprobeSup.

Doing it

Preparation

We use a scenario object created in “generate historical scenarios”.

Optimization

We need to specify the constraints for the portfolio in addition to the utility and the scenarios:

fourmomOpt <- scenario.optimizer(dqScen, 
   utility=pputil.fourmoments, 
   extraArgs=list(parameters=c(-1.2, .5, -.8)), 
   gross.value=1e6, long.only=TRUE, max.weight=.08, 
   port.size=c(20,30))

The constraints for this problem are that the gross value of the portfolio is (close to) $1 million, the portfolio is long-only, no asset may have a weight greater than 8% and there are between 20 and 30 names in the portfolio.

The result is an object that holds the best portfolio found, the trade to get there, and some other information.

Explanation

The parameters argument to the utility (given via extraArgs) needs to be a vector of three numbers.  The utility that is being maximized is the expected return plus the first parameter times the variance plus the second parameter times the skewness plus the third parameter times the kurtosis.

Thus it is standard for the first and third parameters to be negative and the second to be positive.

Note that this is rather a mixed metaphor: the skewness and kurtosis are unitless values.  This adds to the already suspect idea of combining the mean (units of returns) with the variance (units of squared returns).

There is a demand for the current prices in order to constrain the portfolio value.  In this case the default prices are used, which is the first row of the first scenario.

Further details

the number of iterations

You can specify the maximum number of iterations that can be used — the number of bites is the function’s analogy:

fourmomOpt2 <- scenario.optimizer(dqScen, 
   utility=pputil.fourmoments, 
   extraArgs=list(parameters=c(-1.2, .5, -.8)), 
   gross.value=1e6, long.only=TRUE, max.weight=.08,  
   port.size=c(20,30), regulate=c(nbites=100))

maximizing a quantile

The commands above are maximizing the expected value of the utility (taking the mean across scenarios).  Scenario optimization allows us flexibility.  In particular, we can maximize a specific quantile of the utility in this case:

fourmomOpt3 <- scenario.optimizer(dqScen, 
   utility=pputil.fourmoments, 
   extraArgs=list(parameters=c(-1.2, .5, -.8), level=.2),
   gross.value=1e6, long.only=TRUE, max.weight=.08, 
   port.size=c(20,30), regulate=c(nbites=100))

We are maximizing the 20% quantile (by giving the level argument to the utility function) — we want the portfolio to perform well for a large portion of the scenarios.

variance matrix

You can provide a variance matrix in order to impose variance constraints, tracking error constraints or risk fraction constraints.

See also

Navigation