Challenges of portfolio optimization

Intermediate Portfolio Analysis in R

Ross Bennett

Instructor

Challenges

  • Many solvers are not specific to portfolio optimization

  • Understanding the capabilities and limits of solvers to select the appropriate solver for the problem or formulate the problem to fit the solver

  • Difficult to switch between solvers

  • Closed-Form solver (e.g., quadratic programming)

  • Global solver (e.g., differential evolution optimization)

Intermediate Portfolio Analysis in R

Quadratic utility

  • Maximize: $\quad \displaystyle \omega^T * \mu - \lambda * \omega^T * \Sigma * \omega $
  • Subject to:

$$\omega_{i} >= 0$$

$$\sum_{i=1}^{n} \omega_i = 1$$

  • $\omega$ is the weight vector
  • $\mu$ is the expected return vector
  • $\lambda$ is the risk aversion parameter
  • $\Sigma$ is the variance - covariance matrix
Intermediate Portfolio Analysis in R

Quadratic programming solver

  • Use the R package quadprog to solve the quadratic utility optimization problem

  • solve.QP() solves quadratic programming problems of the form:

$$min(-d^Tb+\frac{1}{2}b^TDb)$$

  • Subject to the constraint:

$$A^Tb>=b_0$$

Intermediate Portfolio Analysis in R
library(quadprog)
data(edhec)
dat <- edhec[,1:4]

# Create the constraint matrix
Amat <- cbind(1, diag(ncol(dat)), -diag(ncol(dat)))
# Create the constraint vector
bvec <- c(1, rep(0, ncol(dat)), -rep(1, ncol(dat)))
 # Create the objective matrix
Dmat <- 10 * cov(dat)
# Create the objective vector
dvec <- colMeans(dat)

# Specify number of equality constraints
meq <- 1

# Solve the optimization problem
opt <- solve.QP(Dmat, dvec, Amat, bvec, meq)
Intermediate Portfolio Analysis in R

Let's practice!

Intermediate Portfolio Analysis in R

Preparing Video For Download...