# Analytical portfolio optimization for VaR under multivariate normality

Given a set of assets with returns following a multivariate normal distribution with a known mean vector and a known covariance matrix, $$r \sim N(\mu,\Sigma),$$ I want to find optimal portfolio weights $$w^*$$ that maximize value at risk (VaR), subject to weights summing up to 1 and being nonnegative: $$w^*:=\arg \max_{w} F^{-1}(q) \\ \text{subject to} \\ \quad w^{\top}e=1 \quad \text{and} \quad w>0$$ where $$F(\cdot)$$ is the CDF of the porfolio return, $$q$$ is the quantile of interest, $$e$$ is a vector of ones and $$>$$ holds for each element of $$w$$. $$F$$ is a normal CDF with expectation $$w^{\top}\mu$$ and variance $$w^{\top} \Sigma w$$, the parameters being functions of $$w$$.

Does this problem have an analytical solution?

The elements of the mean vector are not necessarily equal; otherwise a solution is readily available and equals the well-known solution of minimization of portfolio variance.

Note: I do not care about the plausibility of multivariate normality for asset returns; I need this for testing and benchmarking a numerical optimization routine for VaR.

Edit: updated to include formulas and to restrict the question to the case of nonnegative weights (in the original question the latter restriction was optional).

• Maximising VaR with weights being non-negative is non-sensical. Consider selling a low volatility asset in almost infinite amount, and buying a high volatility asset in almost infinite amount. The correlation is irrelevant and your VaR will be unbounded. Furthermore for this objective function the expected returns are redundant information since you are not targeting return, just risk. – Attack68 Dec 11 '19 at 16:16
• Actually my comment might have been a misinterpretation, you want to achieve maximal return and maximal VaR subject to weights equal one. You will still need boundary conditions on the weights, for the above reason. – Attack68 Dec 11 '19 at 16:18
• If the assets returns are jointly normal, then portfolio VaR will be a multiple of the portfolio standard deviation. Then, a mean-variance efficient portfolio will also be mean-VaR efficient, so you would have a benchmark. But this may or may not help, because this only holds for the true distribution. You typically optimize VaR for a scenario set (i.e. a returns sample), and so the results will differ (how much depends on the specific setting and the number scenarios). – Enrico Schumann Dec 11 '19 at 16:53
• @Attack68, thank you for your comments! I have a hard time following them, though. Did you mean with weights being negative instead of with weights being non-negative? Then most of the comments would make sense to me. – Richard Hardy Dec 12 '19 at 11:35
• @Attack68, but if you meant what you wrote: you say Maximising VaR with weights being non-negative is non-sensical. Nonnegative weights are a common restriction in finance; they represent absence of short sales. Regarding for this objective function the expected returns are redundant, this is not quite right. For a normal distribution (which the resulting portfolio return will have), VaR depends on both the variance (or standard deviation) and the expected value. Regarding you want to achieve maximal return and maximal VaR, this is not how my problem is formulated; I care only about VaR. – Richard Hardy Dec 12 '19 at 11:37

If you define VaR as a quantile of the portfolio's returns distribution about the mean of those returns, then the minimum-variance portfolio is what you look for: it minimises the volatility around the mean, whereever this mean is. When returns are jointly normal, maximising VaR as just defined does the same.

Regarding my second comment: numerical procedures for VaR typically directly maximise a given order statistic on a sample of portfolio returns. But then there is no guarantee that in the sample the optimal VaR-portfolio will be the same as the minimum-variance portfolio. Thus, for testing a numerical procedure, knowing the true distribution and generating data from it may not be enough. Example (using R):

I create 2000 scenarios for 10 assets; each may have a weight between 0 and 25%. The returns use ridiculously high mean returns, so that the distribution is shifted away from zero.

library("NMOF")        ## https://github.com/enricoschumann/NMOF
library("neighbours")  ## https://github.com/enricoschumann/neighbours

set.seed(32923)

## create random data
na <- 10              ## number of assets
ns <- 2000            ## number of scenarios
k <- ceiling(ns*0.1)  ## order statistic to maximise
R <- randomReturns(na = na, ns = ns,
mean = runif(na, 200/100/255, 300/100/255),
sd = runif(na, 0.005, 0.02),
rho = 0.6)

## minimum-variance solution
x.qp <- minvar(cov(R), wmin = 0, wmax = 0.25)


The VaR optimisation. The algorithm I use minimises, so I put a minus in front of the VaR.

### 1) objective function
of_var <- function(x, R, k, ...)
-(sort(R %*% x, partial = k)[k] - sum(R %*% x)/nrow(R))

### 2) optimisation with Threshold Accepting
x.ta <- TAopt(
OF = of_var,                    ## SETTINGS
list(nI = 20000,                ### number of iterations
neighbour = neighbourfun(  ### neighbourhood function
min = 0,
max = 0.25,
stepsize = 1/100),
x0 = rep(1/na, na)         ### initial solution: equal weights
),
R = R, k = k)\$xbest


We can compare the resulting portfolios and their returns distributions: the portfolios are very similar.

## compare weights
data.frame(MV  = round(100*x.qp, 2),
VaR = round(100*x.ta, 2))

## compare returns distributions under given sample
plot(ecdf(R %*% rep(1/na, na)),
main = "distribution of portfolio returns")
lines(ecdf(R %*% x.qp), col = "blue")
lines(ecdf(R %*% x.ta), col = "darkgreen")


Finally, I evaluate the VaR-objective function at the minimum-variance and at the minimum-VaR portfolio.

of_var(rep(1/na, na), R, k)  ## equal weight
## [1] 0.01316127
of_var(x.qp, R, k)           ## minimum variance
## [1] 0.008222392
of_var(x.ta, R, k)           ## minimum VaR
## [1] 0.008178637


As you can see, Threshold Accepting found a portfolio that provides a tiny advantage over the minimum-variance portfolio in this particular sample. (This could probably be improved, but it only serves to make the point here.) Under the true distribution, both portfolios should be the same.

You may also define VaR as a quantile of the returns distribution, without the centering. You cannot generally maximise any quantile of the returns distribution. Just think of the median: if you can use leverage and the portfolio has a positive return, you can increase the median (which is the same as the mean under the Gaussian distribution) without bound. So you had better define VaR as a lower quantile. Maximising it is, in a Gaussian world, equivalent to maximising

$$\mu'x - \lambda \sqrt{x' \Sigma x}$$

in which $$\lambda$$ is an appropriate multiplier for the standard deviation, such as 1.645 for the 5% VaR:

> qnorm(0.05)
## [1] -1.644854


This model should not pose much difficulty to a numeric solver. (For the median, $$\lambda$$ would be zero.)

• Thank you for your answer! I am interested in portfolio VaR (the quantile of the return distribution of the portfolio) as commonly defined (e.g. Wikipedia). What you seem to be analyzing here is mean-adjusted portfolio VaR (the quantile of the return distribution of the portfolio minus the mean of that distribution) which is something else than portfolio VaR. – Richard Hardy Dec 14 '19 at 9:25
• As Attack68 mentioned, it would have helped had you specified your model more precisely. I have updated the answer. – Enrico Schumann Dec 20 '19 at 7:04
• I have updated the question with formulas. – Richard Hardy Dec 21 '19 at 11:39