[GSoC-PortA] Volatility weighted benchmark constructor

Peter Carl peter at braverock.com
Mon Oct 7 03:25:26 CEST 2013


Ross,

I mimicked your equal-weight constructor to create an "inverse volatility"
benchmark.  I see this used more frequently in managed futures trading,
where the position is proportioned as one over the volatility of the
asset.

In effect, this gives an interesting metric relative to the equal standard
deviation portfolio, and is a special case where the covariance matrix is
homogeneous. When comparing the two, the inverse volatility benchmark
allows you to ask the question of how much information about sizing is in
the covariance assumptions, relative to that in the volatility
assumptions.  I think it's useful for making that tradeoff between
volatility and correlation much more explicit.

There may be another, more formal name.  Usually we just refer to it as
"volatility weighted" as being similar to "equal weighted".

### Construct BUOY 8: Volatility Weighted Portfolio
# There's only one, so create a portfolio object with all the objectives
we want calculated.
VolWgt.portf <- portfolio.spec(assets=colnames(R))
VolWgt.portf <- add.constraint(portfolio=VolWgt.portf, type="leverage",
min_sum=0.99, max_sum=1.01)
VolWgt.portf <- add.objective(portfolio=VolWgt.portf, type="return",
name="mean")
VolWgt.portf <- add.objective(portfolio=VolWgt.portf, type="risk_budget",
name="ES", arguments=list(p=p, clean=clean))
VolWgt.portf <- add.objective(portfolio=VolWgt.portf, type="risk_budget",
name="StdDev", arguments=list(clean=clean))

### Evaluate BUOY 8: Inverse Volatility Portfolio
inverse.volatility <- function (R, portfolio, ...)
{
  if (!is.portfolio(portfolio))
      stop("portfolio object passed in must be of class 'portfolio'")
  assets <- portfolio$assets
  nassets <- length(assets)
  weights <- as.vector((1/StdDev(R))/sum(1/StdDev(R)))
  names(weights) <- names(assets)
  if (ncol(R) != nassets) {
      if (ncol(R) > nassets) {
          R <- R[, 1:nassets]
          warning("number of assets is less than number of columns in
returns object, subsetting returns object.")
      }
      else {
          stop("number of assets is greater than number of columns in
returns object")
      }
  }
  out <- constrained_objective(w = weights, R = R, portfolio = portfolio,
      trace = TRUE, ...)$objective_measures
  return(structure(list(R = R, weights = weights, objective_measures = out,
      call = match.call(), portfolio = portfolio), class =
c("optimize.portfolio.invol",
      "optimize.portfolio")))
}

# Calculate the objective measures for the vol weight portfolio
VolWgt.opt <- volatility.weight(R=R, portfolio=VolWgt.portf)

At any rate, I think it probably makes sense to include alongside the
equal weight function as another special case.  Let me know what you
think.

pcc
-- 
Peter Carl
http://www.braverock.com/peter




More information about the GSoC-PortA mailing list